This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System cannot find the path specified

 
Gaurav Chikara
Ranch Hand
Posts: 412
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have mapped my "R" drive to a network shared location (I have read/write access to this shared location)

When I am trying to create file using Servlet Action class I get the following error
R:\SUNONELOCAL.txt (The system cannot find the path specified)

but if I try to do the same through standalone program it works fine

Can anyone please suggest what could be the reason for it

Thanks in advance


From standalone program


From Action class code is

 
Duc Vo
Ranch Hand
Posts: 254
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two reasons:
(1) In windows, a mapped network drive is per user only -> if you see the network path under R: doesn't mean that the service account running servlet container can see it on R:
(2) Anyway for security reasons, the default window service account won't be able to access network drives. Hence even if you use the full network location (\\server\etc.) it still won't work.
 
Paul Clapham
Sheriff
Pie
Posts: 20185
26
MySQL Database
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Duc Vo wrote:(1) In windows, a mapped network drive is per user only -> if you see the network path under R: doesn't mean that the service account running servlet container can see it on R:
(2) Anyway for security reasons, the default window service account won't be able to access network drives. Hence even if you use the full network location (\\server\etc.) it still won't work.


Yes, that's true. And if you need your servlet to have access to a UNC path like \\server\etc, here's what you have to do:

  • Create a user profile which has read/write access to that path (don't use your account, make a new one just for this)
  • Configure the service where the servlet container runs, and have it log in as that user profile
  •  
    Gaurav Chikara
    Ranch Hand
    Posts: 412
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Yes, that's true. And if you need your servlet to have access to a UNC path like \\server\etc, here's what you have to do:

  • Create a user profile which has read/write access to that path (don't use your account, make a new one just for this)
  • Configure the service where the servlet container runs, and have it log in as that user profile


  • Thanks a lot for the reply
    I am not sure how to achive the point 2 suggested. Is there some help around (which you are available that can help me in knowing its details)

     
    Paul Clapham
    Sheriff
    Pie
    Posts: 20185
    26
    MySQL Database
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Open the "Services" tool from the Windows control panel. Right-click the service you want to work with and click "Properties". It's in there somewhere, just look around.
     
    Rob Spoor
    Sheriff
    Pie
    Posts: 20380
    46
    Chrome Eclipse IDE Java Windows
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Services is within the Administrative Tools folder inside the control panel. Double click on the service, then go to the Log On tab. Select "This account", then fill in or select the user account and fill in the password twice. Confirm if it asks you to give the user run as service privileges.

    And yes, you'll still need to use \\server\share after that, since shares are only mapped when you login.
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic