aspose file tools*
The moose likes Tomcat and the fly likes Create folder in a remote machine - failing silently Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Create folder in a remote machine - failing silently" Watch "Create folder in a remote machine - failing silently" New topic
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: 18669
    
    8

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: 16145
    
  21

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.
 
Consider Paul's rocket mass heater.
 
subject: Create folder in a remote machine - failing silently