This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Error loading file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Error loading file" Watch "Error loading file" New topic
Author

Error loading file

Svend Rost
Ranch Hand

Joined: Oct 23, 2002
Posts: 904
Hi,

I'd like to load a file from my Servlet and read it's contens, but
I get an "Error loading file" when the code is run.

Where should I place the file ?

My servlet class file lies in: Tomcat/webapps/examples/WEB-INF/classes/
where the file also lies. I contact the Servlet via the following URL:
http://localhost:8080/examples/servlet/<servletname>

Thanks in advance,

/Svend Rost
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Look up ServletContext.getResource or ServletContext.getResourceAsStream.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12998
    
    5
Your use of /servlet/ in the URL indicates you may be getting tangled up in the "invoker" servlet conventions. Read this FAQ on the invoker here at the ranch.
Bill
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Error loading file
 
It's not a secret anymore!