This week's book giveaway is in the Open Source forum.
We're giving away four copies of Programmers Guide to Apache Thrift and have Randy Abernethy on-line!
See this thread for details.
Win a copy of Programmers Guide to Apache Thrift this week in the Open Source forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Create folder in a remote machine - failing silently  RSS feed

 
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!
 
Marshal
Posts: 24461
55
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.
 
Bartender
Posts: 20721
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!