This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Permission denied exception on saving file to filesystem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Permission denied exception on saving file to filesystem" Watch "Permission denied exception on saving file to filesystem" New topic
Author

Permission denied exception on saving file to filesystem

Rituraj tyagi
Greenhorn

Joined: Oct 06, 2009
Posts: 13
Hi All

I was trying to save an uploaded file at the location where application(war) is deployed on tomcat server(free hosting plan) by trying getServletContext().getRealPath() but it returned null instead of path but this worked on local machine . Than I tried to save files to local filesystem on server (let us suppose /var/tmp/../file/) but it thrown an exception Permission denied even though the server gets the locations write and read permissions as true . Below is the code:-



I doubt that the problem is with the security policy of the hosting service but not sure . So guys can you please suggest on this.

Thanks in advance

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Rituraj tyagi wrote:I doubt that the problem is with the security policy of the hosting service but not sure


Quite likely the hosting service does have a security policy which prevents you from using their disk space. Does your contract with the service mention that?
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

Paul Clapham wrote:
Rituraj tyagi wrote:I doubt that the problem is with the security policy of the hosting service but not sure


Quite likely the hosting service does have a security policy which prevents you from using their disk space. Does your contract with the service mention that?

especially as it is free
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Permission denied exception on saving file to filesystem
 
Similar Threads
Submit multipart and form data
take in file from client machine
Eclipse fileupload no longer works
request.getParameter() returning null
Unable to upload file using Swing and Servlets to Server