2014-06-04 19:46 GMT+04:00 Don Asper <[email protected]>:
> Hi:  I want my web apps running on Tomcat 7.0.35 to use a custom classloader. 
>  The reason is that I want each web app classloader instance to do some 
> processing to set up the classpath for the web app it belongs to.  I have the 
> following questions:  1) Is org.apache.catalina.loader.WebappClassLoader  a 
> good class to derive my custom classloader from?  Is it a good choice going 
> forward for later versions of Tomcat?  2) Is there a recommended way for my 
> custom classloader to identify which web app it belongs to?  It needs to 
> identify which web app it is for so that it will know what jars to put on its 
> classpath.  Thanks!

Look at VirtualWebappLoader. Maybe it suits your needs as is.

Also the same trick that it does can be performed from a <Listener>.
There is no need to extend WebappLoader just for that.

A Listener and a WebappLoader have access to Tomcat's Context class
and can get the paths.

The VirtualWebappLoader is not available in Tomcat 8, replaced by new
Pre/Post/... resources APIs.

Beware that webapp's classloader should be able to produce class path
that is used by JSP compiler (Eclipse JCP or by external javac
depending on how your Tomcat is configured). Tomcat WebappClassLoader
has API for that.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to