tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Delbecq <>
Subject Re: Non-servlet class cannot access jar file in ./WEB-INF/lib when a Servlet does
Date Thu, 06 Oct 2005 14:06:49 GMT

all classes of a webapp which do not come from tomcat server itself
do share a common classloader which is an aggregation of the various
classes in all WEB-INF/lib/*.jar and in WEB-INF/classes/**/*.class

If you get a NoClassDefFoundException, that probably mean you asked some
class in server classloader to load some other class (probably by
reflection) which
is located in WEB-INF/lib.  That simply impossible to do because
classloaders use
a child to parent classloading delegation model, not a parent (server)
to child (webapp).

David Delbecq
Jose Maria Ramirez Martinez a écrit :

>Hi, everybody
>I have the next problem:
>A servlet calls a non-servlet class, and this non-servlet class imports classes from a
jar file, 
>but the classloader does not find the class from the jar file
>(so when I call the servlet from an internet browser, I get a NoClassDefFoundException)
>But if a servlet class imports the same classes from the jar, the class loader does find
>I've tried some ways to solve this problem, like:
>   a) unpacking the classes from the jar (this works, but I had the problem that 2 different
jars contained 
>a file with the same name stored in the same directory, so one would replace the other,
and the class fails)
>   b) I thought it would be a security problem so I ran tomcat with a SecurityManager,
but it didn't solve the 
>does somebody has any idea why this is happening???
>can somebody help me to solve this... thanks in advance
>Jose Maria
>$0 Web Hosting with up to 200MB web space, 1000 MB Transfer
>10 Personalized POP and Web E-mail Accounts, and much more.
>Signup at
>To unsubscribe, e-mail:
>For additional commands, e-mail:

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

View raw message