This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Websphere and the fly likes Classloader problem: WAS 5 and Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Websphere
Bookmark "Classloader problem: WAS 5 and Struts" Watch "Classloader problem: WAS 5 and Struts" New topic
Author

Classloader problem: WAS 5 and Struts

Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
Hi -
We are having a problem loading a struts app on WAS 5:
It appears that the classloader doesn't like struts using the default applicationResource.property file via a getResoruceBundle:
Java2 security is enabled.
thank you,
Max
Apr 02 14:27:13.023 | ERROR | MessageResourcesFactory.createFactory
java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:267)
at java.security.AccessController.checkPermission(AccessController.java:394)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:540)
at com.ibm.ws.security.core.SecurityManager.checkPermission(SecurityManager.java:162)
at java.lang.Thread.getContextClassLoader(Thread.java:1109)
at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:201)
at org.apache.struts.util.MessageResourcesFactory.createFactory(MessageResourcesFactory.java:192)
at org.apache.struts.util.MessageResources.getMessageResources(MessageResources.java:576)
at org.apache.struts.action.ActionServlet.initInternal(ActionServlet.java:1329)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:464)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
at com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
at com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:175)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:761)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:257)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.getServletReference(WebAppServletManager.java:382)
at com.ibm.ws.webcontainer.webapp.WebApp.getServletReference(WebApp.java:589)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.calculateInfo(WebAppRequestDispatcherInfo.java:177)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.<init>(WebAppRequestDispatcherInfo.java:59)
at com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1415)
at com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1376)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:196)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
OK, I have since learned that my problem must be due to security policy -- the inability for MessageResouces within struts to read the ApplicationResources.properties. I believe I need to set up a policy file?
Can someone please tell me how i do this?
thank you,
max
John Dale
Ranch Hand

Joined: Feb 22, 2001
Posts: 399

at java.lang.Thread.getContextClassLoader(Thread.java:1109)
at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:201)

Is the struts library being loaded from the usual place?
It looks like one factor here is that the context classloader for the thread is not a "child" of the classloader of the struts package. See the API documentation for Thread.getContextClassLoader.
 
GeeCON Prague 2014
 
subject: Classloader problem: WAS 5 and Struts