Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Tomcat and the fly likes File i/o from Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "File i/o from Tomcat" Watch "File i/o from Tomcat" New topic
Author

File i/o from Tomcat

Gary Pierce
Greenhorn

Joined: Apr 03, 2006
Posts: 3
A servlet, with the help of POJOs, tries to see if a file exists at different locations in the network. It goes thru' a set of locations one by one. When executed, for some locations, it reports that the file does not exist, even though it does actually.
Here is the simplified version of the code. The same code when executed outside the container i.e.,from a main() call, it works fine.
Any suggestions?



Thanks
GP
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

How are you running Tomcat?
If you are running it as a Windows service, check to see if the user under which the service runs has network permissions.

From the services window, you can change which user the service runs under.
This solved the same problem for me.

-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Gary Pierce
Greenhorn

Joined: Apr 03, 2006
Posts: 3
Thanks Ben.
Yes, Tomcat runs as a Windows service, with my network user id account. With the same id, like I said, this works fine when run outside the container as a plain Java program with main() method.

Thanks
GP
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: File i/o from Tomcat
 
Similar Threads
IO
Using "javac" command line
B&S: Need some clarification on RecordNotFound Exception
Usage of getResourceAsStream method
AES encryption from within a Tomcat web container