• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Not able to access Network Drive

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 28417
102
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 28417
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I changed the user as you suggested. It worked. Thanks very much.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic