File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes My Servlet has no permission to upload files...please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "My Servlet has no permission to upload files...please help" Watch "My Servlet has no permission to upload files...please help" New topic
Author

My Servlet has no permission to upload files...please help

ernest fakudze
Ranch Hand

Joined: Aug 27, 2001
Posts: 216
Hi,
Problem: My servlet has a field which is used to upload files from the local file system. It works when I run it locally. When it's online it gives an error saying "access denied (java.io.FilePermission..". I looked at the java docs and I came out with this line ..
FilePermission fp = new FilePermission("<<ALL FILES>>" ,"read");
Having created this file permission object, how then do I use it to grant the permission such that I can read any file from the local system?? Could somebody please help me.

In a time of drastic change it is the learners who inherit the future. The learned usually find themselves equipped to live in a world that no longer exists.<br />Eric Hoffer
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Fortunately, that's not how it works. Java security would not be very secure if you could go around granting yourself permissions just like that
To give yourself this permission, you will probably have to modify the security policy file, or get someone else to do it for you. What type of environment are you trying to run the servlet in? An ISP offering servlet/JSP hosting? What privileges do you have? Can't you write the file to another location where you do have file write permissions?
- Peter
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
dear
if u have the admin permission on the server...change the access permissions there...that wud work...or u can convey this to yr admin
good luck
malhar


Malhar Barai
SOA & Java Book
ernest fakudze
Ranch Hand

Joined: Aug 27, 2001
Posts: 216
Okay you got me Peter lol. I use www.jwebhosting.net (please check it out) for my jsp/sevlet hosting. I pay for it. So maybe I will talk to the guys there and they would advise me. For now all I know is that Java will not let you get away with anything...the security sucks if you ask me. lol!
 
Consider Paul's rocket mass heater.
 
subject: My Servlet has no permission to upload files...please help
 
Similar Threads
File.delete() returns false in an applet
Can't set a codeBase in my .policy file
Image Uploading Problem In Tomcat Live Server
using file chooser
How to get a File object from a InputStream or BufferedReader?