You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jean-pierre Cartal <je...@nextenso.com> on 2002/03/22 14:55:50 UTC

webappclassloader problem

Hi,

I've a webapp which contains has some jar files located in WEB-INF/lib.

One of this jar file contains a class that is using class.forname method 
to instantiate another class located in the same jar file.

Unfortunately, this gives me a java.lang.NoClassDefFoundError.

As I read that previous versions had problem loading jar files located 
under WEB-INF/lib, I upgraded to version 4.0.4b1, but the problem was 
still there.

So I added some code to print which classloader this class was using 
when trying to instantiate and the result is as follow:
WebappClassLoader^M
  available:^M
  delegate: false^M
  repositories:^M
    /WEB-INF/classes/^M
  required:^M
----------> Parent Classloader:^M
StandardClassLoader^M
  available:^M
  delegate: true^M
  repositories:^M
    file:/home/cartaljp/Dev/Tomcat4.0/jakarta-tomcat-4.0.4-b1/classes/^M
    
file:/home/cartaljp/Dev/Tomcat4.0/jakarta-tomcat-4.0.4-b1/lib/naming-factory.jar^M
    
file:/home/cartaljp/Dev/Tomcat4.0/jakarta-tomcat-4.0.4-b1/lib/jasper-compiler.jar^M
    
file:/home/cartaljp/Dev/Tomcat4.0/jakarta-tomcat-4.0.4-b1/lib/jasper-runtime.jar^M
  required:^M
----------> Parent Classloader:^M
StandardClassLoader^M
  available:^M
    Extension[javax.mail, implementationVendor=Sun Microsystems, Inc., 
implementationVendorId=com.sun, implementationVersion=1.2, 
specificationVendor=Sun Microsystems, Inc., specificationVersion=1.2]^M
  delegate: true^M
  repositories:^M
  ....

 From what I understand, the webappclassloader does not take into 
account all jar files located under WEB-INF/lib, hence the 
NoClassDefFoundError.

I'm doing something wrong or is it a problem with the classloader ?



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: webappclassloader problem

Posted by Jean-pierre Cartal <je...@nextenso.com>.
I found the problem.

I was trying to instantiate a class that was located in a jar in 
common/lib, however this class was implementing an interface located in 
a jar in WEB-INF/lib, and thus the signature could not be found :-(

Jean-Pierre.Cartal@nextenso.com wrote:

> Hi,
>
> I've a webapp which contains has some jar files located in WEB-INF/lib.
>
> One of this jar file contains a class that is using class.forname 
> method to instantiate another class located in the same jar file.
>
> Unfortunately, this gives me a java.lang.NoClassDefFoundError.
>
> As I read that previous versions had problem loading jar files located 
> under WEB-INF/lib, I upgraded to version 4.0.4b1, but the problem was 
> still there.
>
> So I added some code to print which classloader this class was using 
> when trying to instantiate and the result is as follow:
> WebappClassLoader^M
>  available:^M
>  delegate: false^M
>  repositories:^M
>    /WEB-INF/classes/^M
>  required:^M
> ----------> Parent Classloader:^M
> StandardClassLoader^M
>  available:^M
>  delegate: true^M
>  repositories:^M
>    file:/home/cartaljp/Dev/Tomcat4.0/jakarta-tomcat-4.0.4-b1/classes/^M
>    
> file:/home/cartaljp/Dev/Tomcat4.0/jakarta-tomcat-4.0.4-b1/lib/naming-factory.jar^M 
>
>    
> file:/home/cartaljp/Dev/Tomcat4.0/jakarta-tomcat-4.0.4-b1/lib/jasper-compiler.jar^M 
>
>    
> file:/home/cartaljp/Dev/Tomcat4.0/jakarta-tomcat-4.0.4-b1/lib/jasper-runtime.jar^M 
>
>  required:^M
> ----------> Parent Classloader:^M
> StandardClassLoader^M
>  available:^M
>    Extension[javax.mail, implementationVendor=Sun Microsystems, Inc., 
> implementationVendorId=com.sun, implementationVersion=1.2, 
> specificationVendor=Sun Microsystems, Inc., specificationVersion=1.2]^M
>  delegate: true^M
>  repositories:^M
>  ....
>
> From what I understand, the webappclassloader does not take into 
> account all jar files located under WEB-INF/lib, hence the 
> NoClassDefFoundError.
>
> I'm doing something wrong or is it a problem with the classloader ?
>
>
>
> -- 
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>
>



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>