Update: 

I tried this webapp in 'apache-tomcat-4.1.39-LE-jdk14' and the code in question 
works fine. So my question is what happened to tomcat 5 and after that makes 
resource loading so difficult? 

It's a very simple call to 
'MyClass.class.getResourceAsStream("myresource.xml")' and the resource is 
definitely present. 

Thanks
Tim




________________________________
From: Timothy Washington <timothyjwashing...@yahoo.ca>
To: users@tomcat.apache.org
Sent: Saturday, March 7, 2009 9:53:30 PM
Subject: java.lang.NullPointerException loading resource from classpath



Hi there, I have what seems to be a very simple problem. 

I've deployed a web application to tomcat. But in the application, when I try 
to load a resource (an XML file), it comes back as null. This is very 
frustrating, because some of the most basic approaches are not working to give 
me my XML resource. I'm using the 
'MyClass.class.getResourceAsStream("myresource.xml")' method, and I've tried 
the following: 
    * placing the resource in i) WEB-INF/lib, ii) WEB-INF/classes 
    * using tomcat versions i) 5.5.27 and ii) 6.0.18
    * setting the classpath in i) conf/catalina.properties ii) manually in 
bin/catalina.sh 
Can anyone help me here? This should be dead simple, so I feel like I'm missing 
something basic. 

Thanks
Tim



      __________________________________________________________________
Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! 
Canada Messenger at http://ca.beta.messenger.yahoo.com/


      __________________________________________________________________
Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! 
Canada Messenger at http://ca.beta.messenger.yahoo.com/

Reply via email to