Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to access Network Drive

 
Prabhat Kumar
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am running Tomcat 6 in Windows Server 2003 operating system. I have a problem accessing network shared drives from within my servlets and JSP-pages.

For instance, if "S" is a mapped drive pointing to something like a
shared network drive "\\shared_server\shared_drive", then this scriplet
returns
"false":

<%
java.io.File file = new java.io.File("S:/test.txt");
boolean exists = file.exists();
out.print("exists: " + exists);
%>

The file "test.txt" does exist, but Tomcat does not see the shared
drive.

Please help.

Thanks,

Prabhat
 
Paul Clapham
Sheriff
Pie
Posts: 20196
26
MySQL Database
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Presumably Tomcat is running as a Windows service. Windows services don't have any network drives mapped.

You could probably deal with that by using the UNC path for the share instead of the version of the path which assumes that a drive has been mapped. But if you do that, make sure the Tomcat service is running as a user which has access to that share. Services which are logged on as the local system account don't have access to UNC paths either.
 
Prabhat Kumar
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your reply.

How should i user UNC path (sorry, i am bit novice) and how should i get assured that my tomcat is running using which user account?

Prabhat
 
Paul Clapham
Sheriff
Pie
Posts: 20196
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prabhat Kumar wrote:How should i user UNC path (sorry, i am bit novice) and how should i get assured that my tomcat is running using which user account?


The UNC path is just like what you posted as an example: \\shared_server\shared_drive

To configure a service to log on as a specific user, go to the Services in the Control Panel (via Administrative Tools). Right-click on the service, select Properties and go to the Log On tab. Enter the user ID and its password.
 
Prabhat Kumar
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I changed the user as you suggested. It worked. Thanks very much.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic