>>> Chris Izquierdo <[EMAIL PROTECTED]> 05-Jul-01 12:41:43 AM
>>>
input = ClassLoader.
getSystemResourceAsStream("test.properties");
properties.load(input);
This code assumes that the file "test.properties" is in
the class path. Where should I put the property file in
the WAR file so that it is in the class path?
Huoston - we have a problem.
Firstly you are not necessarily using the ClassLoader created for the
WAR file. Make sure that you are, you can ensure that by doing this
inside your servlet:
Class c=Class.forName("SomeHelperClass");
ClassLoader cl=c.getClassLoader();
The SomeHelperClass class must be a class declared within your
webapp. You could use a servlet class or some sort of util class (even
a bean).
Second, even when you've done that there is no gaurantee that your
servlet container will provide the implementation of ClassLoader that
you want.
This is what the draft 2.3 spec says
>>>>
SRV.9.7.2 Web Application Classloader
The classloader that a container uses to load a
servlet in a WAR must not allow the WAR to override
J2SE or Java servlet API classes. It is further
recommended that the loader not allow servlets in the
WAR access to the web container s implementation
classes.
It is recommended, however, that the application
classloader be implemented so that classes and resources
packaged within the WAR are loaded in preference
to classes and resources residing in container-wide library
JARs.
<<<<
Note the "recommended" against the pertinent bit. This is 2.3 as
well, you're using a 2.2 API based engine.
However, if the cl is implemented well (and Craig and the others *do
know* what they're talking about so it should be ok) then it will
probably be getting resouces from the WEB-APP root or the WEB-INF
dir.
Try specifically using the WEB-INF dir in the resource name.
Nic Ferrier
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html