This discussion is archived
1 Reply Latest reply: Sep 22, 2011 11:04 AM by 856147 RSS

Glassfish 3.1.1 and SocketPermission problem with JSPs

856147 Newbie
Currently Being Moderated
Hi folks. I hope this is the correct forum for this post. If not let me know and I'll repost in the appropriate one.

I have a legacy project originally done in pure JSP (with a couple of Servlets) that runs on IPlanet and makes rmi based server calls. My first phase is to port this over to glassfish 3.1.1 and, hopefully later, convert it to JSF w/some more current EJB based business end. I have the jsp's and servlets packaged as a single war and have it deployed on glassfish. I have a Login jsp which redirects to a servlet which sets up a new session, preloads the session with specific data and then forward to a 'menu' jsp page which loads your options based on a database. Note: BOTH the servlet and the menu jsp make rmi calls to the server. Here's the strange part - The servlet is successful in establishing the rmi connection and makes a couple of calls to the rmi to connect to the database and get the appropriate data to store into the session. Then it forwards you to the menu jsp. The menu jsp gets the reference to the rmi connection, as well as other data from the session and attempts to make rmi calls to gather your options for the menu. In this case I get a java.security.AccessControlException: access denied (java.net.SocketPermission 192.0.73.26:53178 connect,resolve) error. (Full Stack trace below)
Note: I have attempted to add the following to the server.policy file in my domain1 directory:
grant {
permission java.security.AllPermission;
permission java.lang.RuntimePermission "192.0.73.26:80-65535";
permission java.util.PropertyPermission "*", "read, write";
permission java.net.SocketPermission "192.0.73.26:80-65535", "accept,connect,listen,resolve";     
};
I realize that this is WAY too open, however, this is day two and I've given up on finesse. At this point I just want to get it working. Then I'll clean it up.....

Still No Joy... So I then added the same entry into the java.policy file for my jdk thinking that maybe it was a java permission, not a glassfish permission. Same error.

The thing that really confuses me is that the Servlet works! and the JSP (which is really just another servlet) does not! Which leads me to believe it has something to do with classpaths or classloaders.

Please Help!! Any thoughts would be appreciated.

As promised - full stacktrace follows.

WARNING: StandardWrapperValve[EtalsMenuMgr]: PWC1406: Servlet.service() for servlet EtalsMenuMgr threw exception
java.security.AccessControlException: access denied (java.net.SocketPermission 192.0.73.26:53178 connect,resolve)
     at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
     at java.security.AccessController.checkPermission(AccessController.java:546)
     at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
     at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
     at sun.rmi.transport.tcp.TCPChannel.checkConnectPermission(TCPChannel.java:132)
     at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:161)
     at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110)
     at com.cust.rmi.ServerAppServantAdapter_Stub.getUpp(Unknown Source)
     at com.cust.rmi.ServerAppClientAdapter.getUpp(ServerAppClientAdapter.java:318)
     at org.apache.jsp.EtalsMenuMgr_jsp._jspService(EtalsMenuMgr_jsp.java from :487)
     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
     at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
     at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
     at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
     at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
     at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
     at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
     at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
     at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
     at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
     at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
     at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
     at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
     at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
     at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
     at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
     at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
     at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
     at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
     at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
     at java.lang.Thread.run(Thread.java:619)



Gregory

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points