You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by kr...@dossier.no on 2009/06/30 09:12:56 UTC

jar loading in folder web-inf/lib/folder/*.jar

HI,

Loading of jar files under WEB-INF/lib/a_foolder/*.jar wont work. On JBoss
5.0.1GA this works fine but 
The tomcat class loader cant load thease files., 


Thease jar files (WEB-INF/lib/a_foolder/*.jar) is referenced from the
main.jar file (WEB-INF/lib/main.jar) manifest: 

WEB-INF/lib/main.jar/META-INF/MANIFEST.MF:

/WEB-INF/lib/a_folder/cxf-rt-frontend-jaxws-2.2.jar
/a_folder/geronimo-ws-metadata_2.0_spec-1.1.2.jar

I have also tried with prefix without any success,
WEB-INF/lib/a_folder/cxf-rt-frontend-jaxws-2.2.jar
WEB-FIN/lib/a_folder/geronimo-ws-metadata_2.0_spec-1.1.2.jar

Dosnt tomcat support loading of jar libs within a folder in WEB-INF/lib ?


- Karan 
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jar loading in folder web-inf/lib/folder/*.jar

Posted by Daniel Henrique Alves Lima <em...@yahoo.com.br>.
	Karan, if you really want/need this, try to:

	A) build a.jar an place a start up servlet into it (or any class
loaded/executed when you application starts). Change Classpath entry (in
the manifest of a.jar) to include mylib/b.jar. Put a.jar under WEB/lib;
	B) build b.jar and put it under WEB/lib/mydir/b.jar. Be sure that
Classpath entry (of a.jar's manifest) includes mydir/b.jar;

	Start your app.


On Tue, 2009-06-30 at 14:13 -0300, Daniel Henrique Alves Lima wrote:
> On Tue, 2009-06-30 at 11:59 -0400, Christopher Schultz wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > Karan,
> > 
> > On 6/30/2009 3:12 AM, kr@dossier.no wrote:
> > > Loading of jar files under WEB-INF/lib/a_foolder/*.jar wont work. On JBoss
> > > 5.0.1GA this works fine but 
> > > The tomcat class loader cant load thease files.
> > 
> > Tomcat is following the servlet specification, which does not have any
> > provisions for subdirectories within WEB-INF/lib. JBoss is operating
> > outside the servlet specification in order to support this.
> > 
> > > Thease jar files (WEB-INF/lib/a_foolder/*.jar) is referenced from the
> > > main.jar file (WEB-INF/lib/main.jar) manifest: 
> > > 
> > > WEB-INF/lib/main.jar/META-INF/MANIFEST.MF:
> > > 
> > > /WEB-INF/lib/a_folder/cxf-rt-frontend-jaxws-2.2.jar
> > > /a_folder/geronimo-ws-metadata_2.0_spec-1.1.2.jar
> > 
> > A JAR file's manifest isn't used for any class loading operations,
> > unless the JAR file is being "run" by the JVM such as "java -jar
> > [jarfile]" and the MANIFEST.MF file contains a "Class-Path" entry. The
> > contents of your MANIFEST.MF file are not relevant.
> 
> 	
> I remember Weblogic allowed this CLASSPATH manifest nightmare, but i
> don't recommend it because:
> 
> 1. Even when using WL, only some classloaders (EAR classloader ?)  seems
> to work with this (WAR classloader do not);
> 
> 2. If you write the wrong path, there will be no warning/error message
> and you just discover the problem when you (or your container/app
> server) try to load some classes/resources from that jar;
> 
> 3. I never knew relative to what this entries in manifest file are. I
> think that the path was relative to EAR structure, but (if i'm not
> wrong :-)) CLASSPATH manifest entries are relative to the path of the
> jar that include them. 
> If you declare (in the manifest file of dir_one/a.jar) 'dir_two/b.jar',
> the classloader will try to load dir_two/b.jar FROM dir_one. I think
> that it will try to load dir_one/dir_two/b.jar because a.jar is IN
> dir_one.
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jar loading in folder web-inf/lib/folder/*.jar

Posted by Daniel Henrique Alves Lima <em...@yahoo.com.br>.
On Tue, 2009-06-30 at 11:59 -0400, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Karan,
> 
> On 6/30/2009 3:12 AM, kr@dossier.no wrote:
> > Loading of jar files under WEB-INF/lib/a_foolder/*.jar wont work. On JBoss
> > 5.0.1GA this works fine but 
> > The tomcat class loader cant load thease files.
> 
> Tomcat is following the servlet specification, which does not have any
> provisions for subdirectories within WEB-INF/lib. JBoss is operating
> outside the servlet specification in order to support this.
> 
> > Thease jar files (WEB-INF/lib/a_foolder/*.jar) is referenced from the
> > main.jar file (WEB-INF/lib/main.jar) manifest: 
> > 
> > WEB-INF/lib/main.jar/META-INF/MANIFEST.MF:
> > 
> > /WEB-INF/lib/a_folder/cxf-rt-frontend-jaxws-2.2.jar
> > /a_folder/geronimo-ws-metadata_2.0_spec-1.1.2.jar
> 
> A JAR file's manifest isn't used for any class loading operations,
> unless the JAR file is being "run" by the JVM such as "java -jar
> [jarfile]" and the MANIFEST.MF file contains a "Class-Path" entry. The
> contents of your MANIFEST.MF file are not relevant.

	
I remember Weblogic allowed this CLASSPATH manifest nightmare, but i
don't recommend it because:

1. Even when using WL, only some classloaders (EAR classloader ?)  seems
to work with this (WAR classloader do not);

2. If you write the wrong path, there will be no warning/error message
and you just discover the problem when you (or your container/app
server) try to load some classes/resources from that jar;

3. I never knew relative to what this entries in manifest file are. I
think that the path was relative to EAR structure, but (if i'm not
wrong :-)) CLASSPATH manifest entries are relative to the path of the
jar that include them. 
If you declare (in the manifest file of dir_one/a.jar) 'dir_two/b.jar',
the classloader will try to load dir_two/b.jar FROM dir_one. I think
that it will try to load dir_one/dir_two/b.jar because a.jar is IN
dir_one.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jar loading in folder web-inf/lib/folder/*.jar

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Karan,

On 6/30/2009 3:12 AM, kr@dossier.no wrote:
> Loading of jar files under WEB-INF/lib/a_foolder/*.jar wont work. On JBoss
> 5.0.1GA this works fine but 
> The tomcat class loader cant load thease files.

Tomcat is following the servlet specification, which does not have any
provisions for subdirectories within WEB-INF/lib. JBoss is operating
outside the servlet specification in order to support this.

> Thease jar files (WEB-INF/lib/a_foolder/*.jar) is referenced from the
> main.jar file (WEB-INF/lib/main.jar) manifest: 
> 
> WEB-INF/lib/main.jar/META-INF/MANIFEST.MF:
> 
> /WEB-INF/lib/a_folder/cxf-rt-frontend-jaxws-2.2.jar
> /a_folder/geronimo-ws-metadata_2.0_spec-1.1.2.jar

A JAR file's manifest isn't used for any class loading operations,
unless the JAR file is being "run" by the JVM such as "java -jar
[jarfile]" and the MANIFEST.MF file contains a "Class-Path" entry. The
contents of your MANIFEST.MF file are not relevant.

> I have also tried with prefix without any success,
> WEB-INF/lib/a_folder/cxf-rt-frontend-jaxws-2.2.jar
> WEB-FIN/lib/a_folder/geronimo-ws-metadata_2.0_spec-1.1.2.jar
> 
> Dosnt tomcat support loading of jar libs within a folder in WEB-INF/lib ?

No. If you must have subdirectories within your WEB-INF/lib, you can
either attempt to configure Tomcat's class loaders to do that (I'm not
sure how that would be done) or you can write your own ClassLoader and
use /that/ for your webapp.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkpKNlgACgkQ9CaO5/Lv0PB6jwCgqPdUOpEVa5JYKkmD+SyrxkY+
7IUAniOVjinJSx7Nd43VpMbjE4F6lOv4
=loFf
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org