tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guy Rouillier" <>
Subject RE: Classloading issue: common/lib/servlet-api.jar
Date Tue, 27 Jan 2004 07:42:35 GMT
Shapira, Yoav wrote:
> Howdy,
> - NoClassDefFoundError is different from
> ClassNotFoundException.  Make sure you understand the
> difference.  Then make sure you remove extra copies of the
> servlet APIs from the classpath, specifically if you have
> j2ee.jar or servlet.jar somewhere.

Yoav, thanks for the reply.

ClassNotFoundException - class you explicitly asked for is not found 
NoClassDefFoundError - a class required by your class (through a new,
e.g.) was available at compile time but cannot be found now.

I have no servlet jars other than the ones Tomcat 5.0.18 supplies.  I do
have jboss-j2ee.jar in my classpath, and the code will not compile
without it: "javax\ejb\CreateException.class not found".  I moved the
JBoss jars I put in Tomcat's classpath to a directory outside the JBoss
directory, just to make sure it wasn't picking up classes from that
directory I didn't know about (turns out it was, the JBoss security
classes.)  I think the problem is probably in one of the classes that
reside in jars we build and that are invoked on this page.

At any rate, I can add the subject jar to the Tomcat classpath
explicitly - that is a good-enough solution for now.

> - In addition to Senor Duffy's post, read the Classloader
> How-To in the tomcat documentation.
> Yoav Shapira
> Millennium ChemInformatics
>> -----Original Message-----
>> From: Guy Rouillier []
>> Sent: Monday, January 26, 2004 4:17 PM
>> To: Tomcat Users List
>> Subject: Classloading issue: common/lib/servlet-api.jar
>> I found this message in the archives from Michael Duffy that is
>> relevant to my question: 
>> When Tomcat starts, it assumes the CLASSPATH for your
>> Web app consists of:
>> (1) The rt.jar, of course,
>> (2) All the JARs in TOMCAT_HOME/common/lib, which are
>> visible to all apps,
>> (3) All the JARs in the TOMCAT_HOME/server/lib, which
>> are visible only to Tomcat,
>> (4) All the JARs in your WEB-INF/lib, which are
>> visible only to your app,
>> (5) All the .class files in your WEB-INF/classes,
>> which are visible only to your app.
>> That's it.
>> If your Web app needs a JAR, put it in the WEB-INF/lib
>> and you should be all set. - MOD
>> <<
>> My page (which is running with a security manager, i.e, -security) is
>> getting the following error (partial stack trace):
>> java.lang.NoClassDefFoundError:
>> javax/servlet/http/HttpSessionBindingListener
>>        at java.lang.ClassLoader.defineClass0(Native Method)
>>        at java.lang.ClassLoader.defineClass(   
>> at
>> .java:123 ) 
>> I found that common/lib/servlet-api.jar contains this class, and if I
>> manually add it to the classpath (by editing, my page
>> will then work.  According to the note above, all jars on common/lib
>> should be automatically available to my pages.  I haven't touched
>> Any idea why this jar is not being picked up automatically out of
>> common/lib?  Thanks. 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message