Thanks for the responses! You've both set me on the right track.

Thanks again,
Ian.

-----Original Message-----
From: Jacob Kjome [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 11, 2003 11:33 AM
To: Tomcat Users List
Subject: Re[2]: Classloader access issue

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:[EMAIL PROTECTED]]
>>Sent: Tuesday, February 11, 2003 10:22 AM
>>To: '[EMAIL PROTECTED]'
>>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: [EMAIL PROTECTED]
SY> For additional commands, e-mail: [EMAIL PROTECTED]



-- 
Best regards,
 Jacob                            mailto:[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to