Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread 吴熊敏
The program's default classpath is app/WEB-INF/classes so,you need to put the property files under this folder. That means that when you developping,you should put property files under the src folder. On Mon, 18 Jun 2007 07:46:19 -0700 (PDT) nformosa <[EMAIL PROTECTED]> wrote: > > Hi All, > >

Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread David Smith
Ooops... my fault. I was thinking of getRealPath(). thanks Caldarale, Charles R wrote: From: David Smith [mailto:[EMAIL PROTECTED] Subject: Re: Tomcat / WAR File; Classpath not recognised for properties file The only achilles heal [sic] here is the ServletContext.getResource() method

RE: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread Caldarale, Charles R
> From: David Smith [mailto:[EMAIL PROTECTED] > Subject: Re: Tomcat / WAR File; Classpath not recognised for > properties file > > The only achilles heal [sic] here is the > ServletContext.getResource() method won't work > from a .war archive. The webapp has to be

Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread David Smith
mail and destroy the original message without making a copy. Thank you. - Original Message - From: "Caldarale, Charles R" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Monday, June 18, 2007 11:46 AM Subject: RE: Tomcat / WAR File; Classpath not recognised f

Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread Martin Gainty
" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Monday, June 18, 2007 11:46 AM Subject: RE: Tomcat / WAR File; Classpath not recognised for properties file From: nformosa [mailto:[EMAIL PROTECTED] Subject: Re: Tomcat / WAR File; Classpath not recognised for properties fil

Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread David Smith
If JibxManager is a class you wrote, couldn't you have the servlet resolve the path to resources using ServletContext.getResource( "/webapp-relative/path/to/my/resources" ).getPath() and then pass that in on the JibxManager constructor? The only achilles heal here is the ServletContext.getReso

Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread David Smith
Then I suspect your resource isn't in a place where your webapp's classloaders can find it. --David nformosa wrote: This gives me a null exception! David Smith-2 wrote: BTW, this.getClass().getClassLoader().getResource("resources/myfile.xml").getPath().toString()); should work a

Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread David Smith
Then how does the resource get into the webapp?? Yes, make sure the jar files you generate have the resource files. The other option is to create a WEB-INF/classes/resources folder with your resource files in it. --David nformosa wrote: Neither, I didn't compile the resources with the jar

RE: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread Caldarale, Charles R
> From: nformosa [mailto:[EMAIL PROTECTED] > Subject: Re: Tomcat / WAR File; Classpath not recognised for > properties file > > I didn't compile the resources with the jar file! should i? You don't compiler resources, but the properties file can be placed in the jar.

Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread nformosa
This gives me a null exception! David Smith-2 wrote: > > BTW, > > this.getClass().getClassLoader().getResource("resources/myfile.xml").getPath().toString()); > > > > should work as > > this.getClass().getResource( "/resources/myfile.xml" ).getPath() ; > > No need for all the extra noi

RE: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread nformosa
So, this is my layout.. I've got a servlet which handles the requests. The servlet than instantiates another class. This class called JibxManager (using jibx), then handles the requests and Marshals the xml request. The JibxManager also handles xsd verification, so it has to load the xsd. This

Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread nformosa
Neither, I didn't compile the resources with the jar file! should i? if so how would i then access it? Also i don;t have a classes directory since my code is compiled and jarred and forms part of the WEB-INF/lib Thanks David Smith-2 wrote: > > So where exactly is your "resources/myFile.xml

Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread David Smith
BTW, this.getClass().getClassLoader().getResource("resources/myfile.xml").getPath().toString()); should work as this.getClass().getResource( "/resources/myfile.xml" ).getPath() ; No need for all the extra noise. --David David Smith wrote: So where exactly is your "resources/myFile.xm

RE: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread Caldarale, Charles R
> From: nformosa [mailto:[EMAIL PROTECTED] > Subject: Re: Tomcat / WAR File; Classpath not recognised for > properties file > > Though i'm still having trouble..since the file is being > accessed from a class not the servlet What does that mean (servlets are classes,

Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread David Smith
So where exactly is your "resources/myFile.xml"? Is it in the WEB-INF/classes directory of your webapp or a jar file in WEB-INF/lib? Your method of access requires it be in one of those two places. --David nformosa wrote: David Smith-2 wrote: nformosa wrote: Hi All, I'm having

Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread nformosa
David Smith-2 wrote: > > nformosa wrote: >> Hi All, >> >> I'm having trouble when deploying my WAR application. The War file >> contains >> mainly the WEB.xml, and index.html file and a number of required >> libraries, >> incudling the compiled src code i've written, All libraries are stored >>

Re: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread David Smith
nformosa wrote: > Hi All, > > I'm having trouble when deploying my WAR application. The War file contains > mainly the WEB.xml, and index.html file and a number of required libraries, > incudling the compiled src code i've written, All libraries are stored > within the WEB-INF/libs which is correct

RE: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread Caldarale, Charles R
> From: nformosa [mailto:[EMAIL PROTECTED] > Subject: Tomcat / WAR File; Classpath not recognised for > properties file > > How can i fix this problem? any ideas would really be appreciated! It's in the FAQ: http://wiki.apache.org/tomcat/HowTo#head-45c3314139cb900ddd43dde2ff67153 2e6e844bc -

RE: Tomcat / WAR File; Classpath not recognised for properties file

2007-06-18 Thread Peter Crowther
> From: nformosa [mailto:[EMAIL PROTECTED] > I'm accesing these files using relative paths ie: > /resources/config.xml What code are you using to locate these files? Hopefully something to do with the servlet spec? See, for example, ServletContext.getResource(String). - Peter