• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Tomcat 5 Class Loader

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic