tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Saegesser" <marc.saeges...@apropos.com>
Subject RE: Servlet ClassLoader
Date Fri, 02 Feb 2001 18:43:34 GMT
> -----Original Message-----
> From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
>* Java asked the webapp class loader to find the
>  controller servlet class
>* The webapp class loader did not find the class
>  so it delegated to the shared class loader
>* The shared class loader (which reads from $CATALINA_HOME/lib
>  in Tomcat 4.0 -- the corresponding loader in Tomcat 3.2 reads
>  from the system classpath) and finds your class
>
> Now, when your controller servlet calls Class.forName(), it
> starts from its
> *own* class loader, and looks either there, or upwards.  Of
> course, if your
> components are under WEB-INF/classes or WEB-INF/lib, they are not
> visible ...

The Java2 class loading model is for a loader to "delegate first" to it's
parent loader.  Only if the parent loader (that also delegates first to it's
parent) can't find the class will the original loader try to load it.

The description above shows the webapp loader attempting to load the class
first and only delegating if that fails.  Is this really the case?


Mime
View raw message