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,
>
>
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
> 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
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
" <[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
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
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
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
> 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.
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
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
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
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
> 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,
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
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
>>
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
> 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
-
> 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
19 matches
Mail list logo