| Author |
Create folder in a remote machine - failing silently
|
Tapas Pradhan
Greenhorn
Joined: Oct 23, 2012
Posts: 2
|
|
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
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
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
Joined: Jun 25, 2001
Posts: 14467
|
|
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".
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Tapas Pradhan
Greenhorn
Joined: Oct 23, 2012
Posts: 2
|
|
|
Thanks Tim and Paul, for quick response. It's working fine now, after restarting the service under specific user.
|
 |
 |
|
|
subject: Create folder in a remote machine - failing silently
|
|
|