When a request to load a class from a web application is processed, the WebappX class loader is processed, this class loader will first search in local repositories, and not delegate it before searching. There are exceptions. Classes that are part of JRE base classes cannot be overestimated. For some classes (such as XML parser components in J2SE 1.4+), you can use the function supported by J2SE 1.4 (see General definition of the class loader above). Finally, any JAR class containing servlet API classes will be ignored by the class loader. All other class loaders in Tomcat 5 follow the usual delegation pattern.
Therefore, from the point of view of a web application, loading classes or resources looks in the following repositories in the following order:
Bootstrap classes of your JVM System class loader classes (described above) /WEB-INF/classes of your web application /WEB-INF/lib/*.jar of your web application $CATALINA_HOME/common/classes $CATALINA_HOME/common/endorsed/*.jar $CATALINA_HOME/common/i18n/*.jar $CATALINA_HOME/common/lib/*.jar $CATALINA_BASE/shared/classes $CATALINA_BASE/shared/lib/*.jar
Thus, the search for WEB-INF / classes is performed before WEB-INF / lib
Link: http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
ziggy
source share