struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Evans (JIRA)" <j...@apache.org>
Subject [jira] Reopened: (STR-985) RequestUtils.applicationClass problem with ContextClassLoader
Date Tue, 25 Apr 2006 19:00:48 GMT
     [ http://issues.apache.org/struts/browse/STR-985?page=all ]
     
David Evans reopened STR-985:
-----------------------------

    Assign To:     (was: Struts Developer Mailing List)

> 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: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message