You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Drew Millen <dm...@latitudegeo.com> on 2005/03/04 21:13:18 UTC

Including external libraries with MANIFEST.MF Class-Path property

Hello, 

 

I have a jar file (one.jar) that I am including in my web application
(it is placed in the WEB-INF/lib folder).   The simple structure of the
one.jar file follows:



META-INF/MANIFEST.MF

my/package/Test.class


This jar file contains one class (my.package.Test), and a MANIFEST.MF
file in the META-INF directory.  Within the MANIFEST.MF file, I am
trying to include an external library (two.jar) for use within
Test.class using the MANIFEST.MF Class-Path property.  Here's what my
MANIFEST.MF looks like:

 

Manifest-Version: 5.5

Ant-Version: Apache Ant 1.6.2

Created-By: 1.4.2_06-b03 (Sun Microsystems Inc.)

Class-Path: ext/two.jar

 

When these jar files are deployed to my web application, they reside in
the web application directory structure as described below:



webapp/WEB-INF/lib/one.jar
webapp/WEB-INF/lib/ext/two.jar

 

Obviously, the webapp ClassLoader will not load two.jar, but I was
hoping that specifying the Class-Path property in my MANIFEST for
one.jar would add two.jar to the runtime classpath.

 

my.package.Test.class is trying to use a class within two.jar, but I am
receiving a java.lang.NoClassDefFoundError.  When I run one.jar as a
standalone application (outside of the web application), two.jar is
successfully loaded.

 

Is there something in Tomcat that does not allow external libraries to
be loaded using the Class-Path: property of a MANIFEST.MF file?  Is
there something else I'm missing?

 

Any help appreciated.


Thanks.

 

Drew.