Hi there P, thanks for responding, I got it. Putting my XML resource in the
'WEB-INF/classes' directory is actually one of the first things I tried. When
that didn't work, I tried setting the classpath in
* i) conf/catalina.properties
* ii) manually in bin/catalina.sh and
* iii) in a web.xml init-param setting
None of these approaches worked either. So what I did was to go back and tried
a different invocation to get the resource:
* i) 'MyClass.class.getResourceAsStream("myresource.xml") - not working
* ii) 'MyClass.class.getResourceAsStream("/myresource.xml") - working
now!!
Thanks for the feedback
Tim
________________________________
From: Pid <[email protected]>
To: Tomcat Users List <[email protected]>
Sent: Sunday, March 8, 2009 10:13:58 AM
Subject: Re: java.lang.NullPointerException loading resource from classpath
Timothy Washington wrote:
> * setting the classpath in i) conf/catalina.properties ii) manually in
> bin/catalina.sh
Setting the classpath is a bad idea, don't do it.
Tomcat sets its own classpath & the classpath for individual web
applications, any tinkering you do is likely to produce unpredictable
conditions.
Place the resource in WEB-INF/classes and make sure your class has a
package definition. Let us know if that works.
p
__________________________________________________________________
Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo!
Canada Messenger at http://ca.beta.messenger.yahoo.com/