aspose file tools*
The moose likes Tomcat and the fly likes Tomcat 5 Class Loader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 5 Class Loader" Watch "Tomcat 5 Class Loader" New topic
Author

Tomcat 5 Class Loader

Regis Santos
Ranch Hand

Joined: Mar 23, 2004
Posts: 31
Hello everbody,

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?

Thanks!

Regis Santos


Regis Santos
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Is there a reason you need jasper-runtime.jar and jasper-compile.jar in your web application's WEB-INF/lib folder?
Regis Santos
Ranch Hand

Joined: Mar 23, 2004
Posts: 31
No. There is no reason. I removed the JARs from there.

But, I thought that Tomcat would ignore the jasper-runtime.jar and jasper-compile.jar from the W1/WIB-INF/lib folder, because that JARs were in the common/lib folder.

Maybe I didn't understand the Class Loader funtionality.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat 5 Class Loader