Timothy Washington wrote:
> 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 

Not sure you think that means what I think it means, but bad idea.

>       * ii) manually in bin/catalina.sh and 

See i).

>       * iii) in a web.xml init-param setting  

See 1).

> 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!!

Good, I'm hoping that a) I should have spotted that and b) you aren't
still messsing with classpath variables.

p



> Tim
> 
> 
> 
> ________________________________
> From: Pid <p...@pidster.com>
> To: Tomcat Users List <users@tomcat.apache.org>
> 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/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to