We're trying to understand the rules governing class visibility
under Tomcat. The docs say that in the hierarchy like the one
reproduced below, classloaders can access classes beneath
them, but not beside or above them. From which it follows ...

(i) webapps can't access the XML parser in crimson/xalan.jars
without 'intervention',

(ii) putting a jar containing classes that extend servlet.jar
on the CLASSPATH won't work, because servlet.jar is above
the Application Classloader, so Tomcat has to override
CLASSPATH and the class must be in lib/common or above.

We'd like to know if this is correct or not, and whether there
are rules we've missed. Thanks for your attention.

P.

The hierarchy ...

   CATALINA_HOME
       bin
      classes
       common
        classes
        lib
       conf
       lib
      logs
       server
        classes
        lib
      webapps
        examples
          images
         jsp
         servlets
         WEB-INF
        manager
          (many dirs)
        ROOT
          WEB-INF
           classes
           lib
      work

TOMCAT_HOME/lib/container
(Server Classloader)
crimson.jar
facade22.jar          TOMCAT_HOME/.../WEB-INF/classes
jasper.jar                (Web Apps classloaders)
tomcat_modules.jar
tomcat_util.jar             TOMCAT_HOME/lib/apps
xalan.jar                    (Apps Classloader)
commons-collections.jar
commons-dbcp.jar
commons-pool.jar

   TOMCAT_HOME/lib/common
    (Common Classloader)
      connector_util.jar
      core_util.jar
      etomcat.jar
      jasper-runtime.jar
      servlet.jar
      tomcat_core.jar

   TOMCAT_HOME/lib/tomcat.jar
      (Application Classloader,
      CLASSPATH Classloader)
      User class files

   JAVA_HOME/jre/lib/ext
  (JDK Extensions Classloader)


Reply via email to