tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <>
Subject Re[2]: Classloader access issue
Date Tue, 11 Feb 2003 16:32:41 GMT
Hello Yoav,

The only way to do this, other than Yoav's solution (which is the most
prudent), is to use the Thread Context ClassLoader.  For instance, if
your library in shared/lib is trying to dynamically load a class from
the WebappClassLoader of any particular application, then using
something like Class.forName() will not work.  However, you can use

Class.forName("com.mypackage.MyClass", Thread.currentThread().getContextClassLoader());

However, the main thing to do is not put jars into the common
classloaders that require access to the WebappClassLoader.  Those
should be part of the webapp itself.


Tuesday, February 11, 2003, 9:28:20 AM, you wrote:

SY> Howdy,
SY> Why not deploy a copy of your 3rd party jar with every webapp instead of
SY> putting it in shared/lib?  That's more of a "true" (self-contained)
SY> webapp deployment and avoids a lot of nasty classloader issues.

SY> Yoav Shapira
SY> Millennium ChemInformatics

>>-----Original Message-----
>>From: Zabel, Ian []
>>Sent: Tuesday, February 11, 2003 10:22 AM
>>To: ''
>>Subject: Classloader access issue
>>Is there a way to access Tomcat4's classloaders for the common/lib,
>>webapps/{webapp}/WEB-INF/lib, shared/lib?
>>We deploy with a war file, which is extracted into the webapps
SY> directory,
>>but we rely on another third party jar that we keep in shared/lib which
SY> now
>>needs to be able to access the classes for our webapp in the jars in
>>WEB-INF/lib dir. Is this possible?
>>We are able to workaround the problem by putting our extracted jars
SY> from
>>war into shared/lib along with the third party jar, but this is far
SY> from
>>desirable, as it would no longer be a true "Webapp" deployment.
>>If we can somehow access the classloader for the webapp, we could pass
SY> it
>>this third party jar, but I doubt it is possible...
>>Any suggestions?

SY> ---------------------------------------------------------------------
SY> To unsubscribe, e-mail:
SY> For additional commands, e-mail:

Best regards,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message