File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Products » Tomcat
Bookmark "cannot find resources" Watch "cannot find resources" New topic

cannot find resources

Michel de Lange

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";
InputStream fstream = this.getClass().getResourceAsStream(fileName);
DataInputStream in = new DataInputStream(fstream);


And Tomcat never finds the file. I get:

at Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)

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

Many thanks for your help,

I agree. Here's the link:
subject: cannot find resources
It's not a secret anymore!