[ http://issues.apache.org/struts/browse/STR-985?page=all ]
David Evans closed STR-985:
---------------------------
Resolution: Fixed
> RequestUtils.applicationClass problem with ContextClassLoader
> -------------------------------------------------------------
>
> Key: STR-985
> URL: http://issues.apache.org/struts/browse/STR-985
> Project: Struts Action 1
> Type: Improvement
> Components: Action
> Versions: Nightly Build
> Environment: Operating System: All
> Platform: All
> Reporter: Kjeld Froberg
> Priority: Minor
>
> When the Struts example shipped is loaded, it initializes some resources as
> static fields.
> However when loading these classes, it uses the RequestUtils.applicationClass
> method, and this method uses the ContextClassLoader to lookup the requested
> class.
> But because it is loading the classes in a static field, it cannot be sure
> that
> the ContextClassLoader has all classes from f.x. WEB-INF/lib loaded.
> I'm using the Trifork app. server, and it gets a ClassNotFoundException from a
> class contained in the struts.jar, but if i use Tomcat it seems to work fine,
> that's because (I presume) the ContextClassLoader is null at the time.
> "Snippet from RequestUtils"
> // Look up the class loader to be used
> ClassLoader classLoader =
> Thread.currentThread().getContextClassLoader();
> if (classLoader == null) {
> classLoader = RequestUtils.class.getClassLoader();
> }
> A solution to the problem could be,
> if you look at the forum for Hibernate it has a good description how to use
> the
> ContextClassLoader in a multiple classloader environment (an app.server f.x.)
> http://sourceforge.net/forum/message.php?msg_id=1720229
> please notify me if you want further information
> Kjeld Froberg
> Software Engineer
> Trifork
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]