File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes ClassNotFoundException Error in Tomcat 5.5 and Tomcat 6.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "ClassNotFoundException Error in Tomcat 5.5 and Tomcat 6.0" Watch "ClassNotFoundException Error in Tomcat 5.5 and Tomcat 6.0" New topic

ClassNotFoundException Error in Tomcat 5.5 and Tomcat 6.0

Venkata Pavan Kumar Sannisetty

Joined: Jun 08, 2012
Posts: 2
I am having this strange issue with the tomcat 5.5 and tomcat 6.0 servers. I have two web applications which will be installed on tomcat.When tomcat is started these two web applications also get started simultaneously but sometimes one web application fails to initialize because of the init failure in one application another application is getting classnotfoundexception errors while running. In tomcat 7.0 the application is running fine even if the other application failed to initialize.

After some debugging i came to know there is one jar named crystal.jar which is in the web-inf/lib folder of both applications. I have moved the jar to common/lib folder of tomcat then it started working fine. I want to know why it is working fine in tomcat 7.0 not in tomcat 5.x and tomcat 6.x versions. Is there any change in classloading architecture between these versions ?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

Welcome to the JavaRanch, Venkata!

There were significant changes in classpaths between Tomcat 5.x and 6.0, but not so much between 6.0 and 7.0.

Usually people have problems when they don't keep their application libraries in WEB-INF/lib. When you put them in the server common library directory you risk threading-related problems unless the libraries are explicitly designed to be shared.

Does the crystal.jar by any chance reference native-code classes? Like maybe an external DLL?

An IDE is no substitute for an Intelligent Developer.
Venkata Pavan Kumar Sannisetty

Joined: Jun 08, 2012
Posts: 2
Thanks Tim.

The library was in the location of both the applications WEB-INF\lib directory and they have no dependency with the external DLLS. Just now i read about tomcat 5.5 classloader architecture and came to know that every web application have its own class loader. The libraries in WEB-INF\lib folder and classes folder will be loaded into this classloader. The libraries whichever stored under common directory will be places into a shared classloader. Then this library should be loaded seperately in seperate class loaders. There by even if one web application fails to start other web application should work independently. That's why i felt strange and need to investigate furthur.
I agree. Here's the link:
subject: ClassNotFoundException Error in Tomcat 5.5 and Tomcat 6.0
It's not a secret anymore!