WebappClassLoader won't load resource from jar file ?!?

2003-11-18 Thread Steph Richardson

I have a web app containing resource files in several jar files, but I am unable to 
access the resources at runtime unless they are
exploded into the classes directory.

When trying to access the resource files using ClassLoader.getResourceAsStream( 
/meta-inf/com/kvasar/data.xml ) I always get null
returned, even though that resource does exist inside a jar file in the web app's 
WEB-INF/lib directory.

If I extract that resource to the classes directory, so I now have 
WEB-INF/classes/meta-inf/com/kvasar/data.xml, then I get it fine
using the exact same path and ClassLoader - it works fine.

The Tomcat Class Loader HOW-TO is telling me that it should find it in the jar.

I have this problem on Tomcat 4.0.1  4.1.24, Win 2K
The ClassLoader instance I am using for the getResourceAsStream() calls, is one that I 
get from one of my classes that is deployed
to my webapp in a war file. Logging a toString() on this ClassLoader is shown below. 
Is it meaningful that it doesn't list my jar
files in it's list of repositories ??



---
WebappClassLoader
  available:
  delegate: false
  repositories:
/WEB-INF/classes/
  required:
-- Parent Classloader:
StandardClassLoader
  available:
Extension[javax.mail, implementationVendor=Sun Microsystems, Inc., 
implementationVendorId=com.sun, implementationVer
sion=1.2, specificationVendor=Sun Microsystems, Inc., specificationVersion=1.2]
  delegate: true
  repositories:
file:C:\Tomcat.4.0-retired\classes\
file:C:\Tomcat.4.0-retired\lib\activation.jar
file:C:\Tomcat.4.0-retired\lib\catalina.jar
file:C:\Tomcat.4.0-retired\lib\jakarta-oro-2.0.2-dev-2.jar
file:C:\Tomcat.4.0-retired\lib\jakarta-regexp-1.2.jar
file:C:\Tomcat.4.0-retired\lib\mail.jar
file:C:\Tomcat.4.0-retired\lib\mailet.jar
file:C:\Tomcat.4.0-retired\lib\xml4j.jar
  required:
-- Parent Classloader:
StandardClassLoader
  available:
Extension[javax.mail, implementationVendor=Sun Microsystems, Inc., 
implementationVendorId=com.sun, implementationVer
sion=1.2, specificationVendor=Sun Microsystems, Inc., specificationVersion=1.2]
  delegate: true
  repositories:
file:C:\Tomcat.4.0-retired\common\classes\
file:C:\Tomcat.4.0-retired\common\lib\activation.jar
file:C:\Tomcat.4.0-retired\common\lib\jasper-compiler.jar
file:C:\Tomcat.4.0-retired\common\lib\jasper-runtime.jar
file:C:\Tomcat.4.0-retired\common\lib\jta.jar
file:C:\Tomcat.4.0-retired\common\lib\mail.jar
file:C:\Tomcat.4.0-retired\common\lib\naming-common.jar
file:C:\Tomcat.4.0-retired\common\lib\naming-factory.jar
file:C:\Tomcat.4.0-retired\common\lib\naming-resources.jar
file:C:\Tomcat.4.0-retired\common\lib\pbclient.jar
file:C:\Tomcat.4.0-retired\common\lib\servlet.jar
file:C:\Tomcat.4.0-retired\common\lib\tools.jar
file:C:\Tomcat.4.0-retired\common\lib\tyrex-0.9.7.0.jar
  required:
-- Parent Classloader:
[EMAIL PROTECTED]









Help !
Thanks !

Steph


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: WebappClassLoader won't load resource from jar file ?!?

2003-11-18 Thread Jay Garala
Put the JARs in the WEB-INF/lib dir! 

-Original Message-
From: Steph Richardson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 18, 2003 11:34 AM
To: Tomcat Users List
Subject: WebappClassLoader won't load resource from jar file ?!?


I have a web app containing resource files in several jar files, but I am
unable to access the resources at runtime unless they are exploded into the
classes directory.

When trying to access the resource files using
ClassLoader.getResourceAsStream( /meta-inf/com/kvasar/data.xml ) I always
get null returned, even though that resource does exist inside a jar file in
the web app's WEB-INF/lib directory.

If I extract that resource to the classes directory, so I now have
WEB-INF/classes/meta-inf/com/kvasar/data.xml, then I get it fine using the
exact same path and ClassLoader - it works fine.

The Tomcat Class Loader HOW-TO is telling me that it should find it in the
jar.

I have this problem on Tomcat 4.0.1  4.1.24, Win 2K The ClassLoader
instance I am using for the getResourceAsStream() calls, is one that I get
from one of my classes that is deployed to my webapp in a war file. Logging
a toString() on this ClassLoader is shown below. Is it meaningful that it
doesn't list my jar files in it's list of repositories ??




---
WebappClassLoader
  available:
  delegate: false
  repositories:
/WEB-INF/classes/
  required:
-- Parent Classloader:
StandardClassLoader
  available:
Extension[javax.mail, implementationVendor=Sun Microsystems, Inc.,
implementationVendorId=com.sun, implementationVer sion=1.2,
specificationVendor=Sun Microsystems, Inc., specificationVersion=1.2]
  delegate: true
  repositories:
file:C:\Tomcat.4.0-retired\classes\
file:C:\Tomcat.4.0-retired\lib\activation.jar
file:C:\Tomcat.4.0-retired\lib\catalina.jar
file:C:\Tomcat.4.0-retired\lib\jakarta-oro-2.0.2-dev-2.jar
file:C:\Tomcat.4.0-retired\lib\jakarta-regexp-1.2.jar
file:C:\Tomcat.4.0-retired\lib\mail.jar
file:C:\Tomcat.4.0-retired\lib\mailet.jar
file:C:\Tomcat.4.0-retired\lib\xml4j.jar
  required:
-- Parent Classloader:
StandardClassLoader
  available:
Extension[javax.mail, implementationVendor=Sun Microsystems, Inc.,
implementationVendorId=com.sun, implementationVer sion=1.2,
specificationVendor=Sun Microsystems, Inc., specificationVersion=1.2]
  delegate: true
  repositories:
file:C:\Tomcat.4.0-retired\common\classes\
file:C:\Tomcat.4.0-retired\common\lib\activation.jar
file:C:\Tomcat.4.0-retired\common\lib\jasper-compiler.jar
file:C:\Tomcat.4.0-retired\common\lib\jasper-runtime.jar
file:C:\Tomcat.4.0-retired\common\lib\jta.jar
file:C:\Tomcat.4.0-retired\common\lib\mail.jar
file:C:\Tomcat.4.0-retired\common\lib\naming-common.jar
file:C:\Tomcat.4.0-retired\common\lib\naming-factory.jar
file:C:\Tomcat.4.0-retired\common\lib\naming-resources.jar
file:C:\Tomcat.4.0-retired\common\lib\pbclient.jar
file:C:\Tomcat.4.0-retired\common\lib\servlet.jar
file:C:\Tomcat.4.0-retired\common\lib\tools.jar
file:C:\Tomcat.4.0-retired\common\lib\tyrex-0.9.7.0.jar
  required:
-- Parent Classloader:
[EMAIL PROTECTED]









Help !
Thanks !

Steph


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: WebappClassLoader won't load resource from jar file ?!?

2003-11-18 Thread Shapira, Yoav

Howdy,
He's already doing that.  I think the problem is in the argument to
ClassLoader#getResourceAsStream, specifically the case of meta-inf
should be all uppercase.

But to be safe, put your resource in the top level of the jar and try
getResourceAsStream(/data.xml).

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Jay Garala [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 18, 2003 11:40 AM
To: 'Tomcat Users List'
Subject: RE: WebappClassLoader won't load resource from jar file ?!?

Put the JARs in the WEB-INF/lib dir!

-Original Message-
From: Steph Richardson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 18, 2003 11:34 AM
To: Tomcat Users List
Subject: WebappClassLoader won't load resource from jar file ?!?


I have a web app containing resource files in several jar files, but I
am
unable to access the resources at runtime unless they are exploded into
the
classes directory.

When trying to access the resource files using
ClassLoader.getResourceAsStream( /meta-inf/com/kvasar/data.xml ) I
always
get null returned, even though that resource does exist inside a jar
file
in
the web app's WEB-INF/lib directory.

If I extract that resource to the classes directory, so I now have
WEB-INF/classes/meta-inf/com/kvasar/data.xml, then I get it fine using
the
exact same path and ClassLoader - it works fine.

The Tomcat Class Loader HOW-TO is telling me that it should find it in
the
jar.

I have this problem on Tomcat 4.0.1  4.1.24, Win 2K The ClassLoader
instance I am using for the getResourceAsStream() calls, is one that I
get
from one of my classes that is deployed to my webapp in a war file.
Logging
a toString() on this ClassLoader is shown below. Is it meaningful that
it
doesn't list my jar files in it's list of repositories ??



---

-
---
WebappClassLoader
  available:
  delegate: false
  repositories:
/WEB-INF/classes/
  required:
-- Parent Classloader:
StandardClassLoader
  available:
Extension[javax.mail, implementationVendor=Sun Microsystems, Inc.,
implementationVendorId=com.sun, implementationVer sion=1.2,
specificationVendor=Sun Microsystems, Inc., specificationVersion=1.2]
  delegate: true
  repositories:
file:C:\Tomcat.4.0-retired\classes\
file:C:\Tomcat.4.0-retired\lib\activation.jar
file:C:\Tomcat.4.0-retired\lib\catalina.jar
file:C:\Tomcat.4.0-retired\lib\jakarta-oro-2.0.2-dev-2.jar
file:C:\Tomcat.4.0-retired\lib\jakarta-regexp-1.2.jar
file:C:\Tomcat.4.0-retired\lib\mail.jar
file:C:\Tomcat.4.0-retired\lib\mailet.jar
file:C:\Tomcat.4.0-retired\lib\xml4j.jar
  required:
-- Parent Classloader:
StandardClassLoader
  available:
Extension[javax.mail, implementationVendor=Sun Microsystems, Inc.,
implementationVendorId=com.sun, implementationVer sion=1.2,
specificationVendor=Sun Microsystems, Inc., specificationVersion=1.2]
  delegate: true
  repositories:
file:C:\Tomcat.4.0-retired\common\classes\
file:C:\Tomcat.4.0-retired\common\lib\activation.jar
file:C:\Tomcat.4.0-retired\common\lib\jasper-compiler.jar
file:C:\Tomcat.4.0-retired\common\lib\jasper-runtime.jar
file:C:\Tomcat.4.0-retired\common\lib\jta.jar
file:C:\Tomcat.4.0-retired\common\lib\mail.jar
file:C:\Tomcat.4.0-retired\common\lib\naming-common.jar
file:C:\Tomcat.4.0-retired\common\lib\naming-factory.jar
file:C:\Tomcat.4.0-retired\common\lib\naming-resources.jar
file:C:\Tomcat.4.0-retired\common\lib\pbclient.jar
file:C:\Tomcat.4.0-retired\common\lib\servlet.jar
file:C:\Tomcat.4.0-retired\common\lib\tools.jar
file:C:\Tomcat.4.0-retired\common\lib\tyrex-0.9.7.0.jar
  required:
-- Parent Classloader:
[EMAIL PROTECTED]









Help !
Thanks !

Steph


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]