You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Sankaranarayanan (Ganesh) Ganapathy" <sg...@vitria.com> on 2003/01/28 02:55:52 UTC

Tomcat 4x Classloading

Hi All,

It has been my observation that the system CLASSPATH classes are loaded in precedence to the web application class files. i.e if I had a web application class file in my CLASSPATH and well as my web application class repository (WEB-INF/classes) - the one in the system CLASSPATH is what is loaded. 

I looked at the source of the web application class loader - I see that the system classloader is first given a chance to find the class file - to prevent the user from overriding the standard J2SE classes. 

This is contrary to what the documentation in the apache site says. I have included the relevant portions with this mail. 

Am I missing something here?

--Ganesh

When a request to load a class from the web application's WebappX class loader is processed, this class loader will look in the local repositories first, instead of delegating before looking. All other class loaders in Tomcat 4 follow the usual delegation pattern.
Therefore, from the perspective of a web application, class or resource loading looks in the following repositories, in this order:
*	/WEB-INF/classes of your web application 
*	/WEB-INF/lib/*.jar of your web application 
*	Bootstrap classes of your JVM 
*	System class loader classses (described above) 
*	$CATALINA_HOME/common/classes 
*	$CATALINA_HOME/common/endorsed/*.jar 
*	$CATALINA_HOME/common/lib/*.jar 
*	$CATALINA_HOME/shared/classes 
*	$CATALINA_HOME/shared/lib/*.jar 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>