tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
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.

Jake

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 [mailto:IZabel@cirqit.com]
>>Sent: Tuesday, February 11, 2003 10:22 AM
>>To: 'tomcat-user@jakarta.apache.org'
>>Subject: Classloader access issue
>>
>>Listers,
>>
>>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
>>the
>>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
>>to
>>this third party jar, but I doubt it is possible...
>>
>>Any suggestions?
>>
>>Ian.

SY> ---------------------------------------------------------------------
SY> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
SY> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



-- 
Best regards,
 Jacob                            mailto:hoju@visi.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message