• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create folder in a remote machine - failing silently

 
Tapas Pradhan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a webapp deployed in tomcat. All I want to do is create a folder in remote machine, accessible through LAN, like say //FileServer/Filocation/temp. I'm using a code like (new File(<{filelocation}>)).mkdirs so that all missing directories are created. It works when I change <{filelocation}> to say C:/Temp it works. When I point to lan location //FileServer/Filelocation/temp it always return false, indicating filke was not created. It doesn't throw any exceptions and nothing in LOGS to tell me anything.

1. Asked sysadmins to run tomcat under the domain user, who has permissions to the LAN location. I didn't solve anything.
2. Is there any conf files in tomcat, where I should give access to the user to access LAN or something? I don't even know where to start looking for it.

Any help on this is appreciated!
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're running Tomcat as a Windows service (which it sounds like you are) then you have to run the service as a specific user who has access to the UNC path in question. Those generic user accounts aren't good enough.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Tapas!

Tomcat doesn't know or care about specific details of fileshares. So there are no options to set.

However, if you are attempting to access the fileshare using its UNC path, that won't work because the core java.io.File classes don't support UNC. You need to map the share to an actual drive letter and use the drive-based path, instead. Something like: " W:/Filocation/temp".
 
Tapas Pradhan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim and Paul, for quick response. It's working fine now, after restarting the service under specific user.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic