I've read in Tomcat 5 Docs that when a web application needs a class or a resource, the Class Loader looks in the following repositories, in this order:
-> 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 -> $CATALINA_HOME/common/classes -> $CATALINA_HOME/common/endorsed/*.jar -> $CATALINA_HOME/common/lib/*.jar -> $CATALINA_BASE/shared/classes -> $CATALINA_BASE/shared/lib/*.jar
Recently, I copied a web application (called W1) from a Tomcat 4.0.18 to a Tomcat 5.0.28 and in the W1/WEB-INF/lib folder had two common JAR files: jasper-runtime.jar and jasper-compile.jar, both from Tomcat 4.x version.
Then, I started the server (Tomcat 5) and the application W1. After that, I deployed a second web application (called W2) that was devolped using the new JSP spec (it means that I've written my JSP's with EL - Expression Language). In the W2/WEB-INF/lib folder, there wasn't any jasper-*.jar. My objective was to use the jasper-runtime.jar and the jasper-compile.jar from the common/lib folder.
When I tried to access the W2 application... CRASH!!! (See the details below)
After that, I undeployed the W1 application and removed the files (include the JARs from the WEB-INF/lib folder and... TADA!!! The W2 application worked.
I know that the JARs was the problem and that they are not compatible with the JARs from the Tomcat 5 commom/lib folder.
My question is: Why didn't Tomcat load the class from jasper-runtime.jar in the common/lib folder when I tried to access the W2 app? Should not Tomcat isolate the libs from a webapp, making the classes accessible only for that application?