File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes cannot find resources Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "cannot find resources" Watch "cannot find resources" New topic
Author

cannot find resources

Michel de Lange
Greenhorn

Joined: Jun 08, 2006
Posts: 1
I am sorry to trouble you folks with such a seemingly trivial problem, but I cannot work this out.

My servlet cannot find any of my resources (files). In my code, I have

String fileName= "infotext.html";
try{
InputStream fstream = this.getClass().getResourceAsStream(fileName);
DataInputStream in = new DataInputStream(fstream);


etc

And Tomcat never finds the file. I get:

java.lang.NullPointerException
at java.io.DataInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)



My file infotext.html is in WEB-INF/classes/ and for good measure also in
/WEB-INF/lib/resources.jar

Many thanks for your help,


Michel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot find resources
 
Similar Threads
problem in rediredtin GUI to IO Streams
My applet is not being seen in its jar anymore. Please help!
ClassNotFoundException
Applet in JSP
JNLP applet to servlet communication problems -Directory Structure