tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arthur Ash <arthur....@epropose.com>
Subject Servlet ClassLoader
Date Thu, 01 Feb 2001 23:07:00 GMT
Hi Folks,

I'm having a general issue with the app-specific classpath (WEB-INF/classes 
and WEB-INF/lib/*.jar).

Here is the scenario as I understand it:
I have an MVC servlet/bean framework that is installed in the primordial 
classpath.  It contains a single dispatcher servlet which instantiates 
handler classes (which function like servlets) using Class.forName().   My 
intention is to to put these app-specific handler classes in 
WEB-INF/classes or WEB-INF/lib in order to be a good J2EE citizen.

However, since the dispatch servlet has been loaded with the primordial 
class loader (ie, the Tomcat code first tried and succeeded to load it 
using the default class loader), when it itslef calls Class.forName(), it 
gets this same (primordial) ClassLoader.  It cannot see anything that is in 
WEB-INF, since this is visible to only to the servlet class loader (ie, 
com.apache.tomcat.loader.AdaptiveClassLoader).

Am I just screwed or is there some cool trick that I am missing?  Of course 
I could change the deployment scheme to put a copy of the dispatcher 
servlet into each apps WE-INF/classes, but this seems a bit clunky.

thanks
Arthur


Mime
View raw message