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 How to configure tomcat to read files on mapped network drive 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 "How to configure tomcat to read files on mapped network drive" Watch "How to configure tomcat to read files on mapped network drive" New topic
Author

How to configure tomcat to read files on mapped network drive

X Smith
Greenhorn

Joined: Aug 18, 2005
Posts: 2
If I run the file reader of S:\test.txt as an application out side of TOM cat is fine. If I run it in tomcat through JSP page, it says "Path not found" Can some one help?

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41034
    
  43
Inside of a web application you need to absolute paths, not relative paths like "test.txt", because a web app has no notion of a default directory. Or are you actually using "S:\\test.xt" as path? You could investigate by having the JSP print out the full path.


Ping & DNS - my free Android networking tools app
X Smith
Greenhorn

Joined: Aug 18, 2005
Posts: 2
Thanks for replying. I did use the absolute path "s:\\test.txt" . If I put the file on my local drive and I put "C:\test.txt" in FileReader(), it works. If I put the file to S drive which is a mapped network drive and put "S:\test.txt" in FileReader(), it does not work.

There are something related to Tomcat login user permission. Do you think so?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41034
    
  43
I'm not all that familiar with using Windows network drives in Java, but you can try using the UNC naming convention, i.e. "\\server\share\file_path" instead.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to configure tomcat to read files on mapped network drive
 
Similar Threads
which app server is easy for j2ee developing.
tomcat not starting
SOAP AND TOMCAT, Error
IntelliJ Community edition
Tomcat and iSeries