I think the current description of the classloader delegation model
from a web application's perspective is still somewhat misleading.

Currently, the document describes 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) 
  [...]

Shouldn't this really be:

  Bootstrap classes of your JVM 
  System class loader classses (described above) 
  /WEB-INF/classes of your web application 
  /WEB-INF/lib/*.jar of your web application 
  [...]

Otherwise, Remy's fix of putting commons-logging-api.jar in the system
class loader would not have worked, as org.apache.commons.logging.Log
would be loaded by two different classloaders (the system classloader
and the WebappClassLoader), and

  Log.class.isAssignableFrom(logClass)

in LogFactoryImpl.getLogConstructor would return false.

Also, this would be consistent with the impl of
WebappClassLoader.loadClass, which calls "system.loadClass(name)"
*before* checking to see if the classloading should be delegated to
the parent, and it would be consistent with a description of how/when
WebappX delegates earlier in the document ("[...] There are
exceptions. Classes which are part of the JRE base classes cannot be
overriden [...]").

Also, I think "org.apache.commons.logging.* " should no longer be
called out in the list of packages that trigger delegation, as it has
been superseded by placing commons-logging-api.jar in
$CATALINA_HOME/bin.

Following is a patch:


Index: class-loader-howto.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/class-loader-howto.xml,v
retrieving revision 1.5
diff -u -r1.5 class-loader-howto.xml
--- class-loader-howto.xml      8 Sep 2003 13:49:32 -0000       1.5
+++ class-loader-howto.xml      8 Sep 2003 17:23:56 -0000
@@ -203,7 +203,6 @@
 <li><em>javax.*</em></li>
 <li><em>org.xml.sax.*</em></li>
 <li><em>org.w3c.dom.*</em></li>
-<li><em>org.apache.commons.logging.*</em></li>
 <li><em>org.apache.xerces.*</em></li>
 <li><em>org.apache.xalan.*</em></li>
 </ul>
@@ -214,10 +213,10 @@
 <p>Therefore, from the perspective of a web application, class or resource
 loading looks in the following repositories, in this order:</p>
 <ul>
-<li><em>/WEB-INF/classes</em> of your web application</li>
-<li><em>/WEB-INF/lib/*.jar</em> of your web application</li>
 <li>Bootstrap classes of your JVM</li>
 <li>System class loader classses (described above)</li>
+<li><em>/WEB-INF/classes</em> of your web application</li>
+<li><em>/WEB-INF/lib/*.jar</em> of your web application</li>
 <li><em>$CATALINA_HOME/common/classes</em></li>
 <li><em>$CATALINA_HOME/common/endorsed/*.jar</em></li>
 <li><em>$CATALINA_HOME/common/lib/*.jar</em></li>


Jan

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

Reply via email to