DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14332>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14332

RequestUtils.applicationClass problem with ContextClassLoader

           Summary: RequestUtils.applicationClass problem with
                    ContextClassLoader
           Product: Struts
           Version: 1.1 Beta 2
          Platform: All
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Utilities
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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

--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>

Reply via email to