Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.security.AccessControlException access denied (java.io.FilePermission

843811Jan 3 2004 — edited Jan 18 2004
When I try 2 upload a file using Fileupload framework, I am getting error

"java.security.AccessControlException : access denied (java.io.FilePermission
/home/virtual/site50/fst/var/www/html/tmp/upload_00000012.tmp delete)".

I host my site in Tomcat Server which is running on Redhat Linux.
In my root I created 'tmp' directory and I set the reposity path using
DiskFileUpload.setRepositoryPath(getServletContext().getRealPath("/") + "tmp");

I have given all the permissions(read,write,execute,delete) to the 'tmp' directory.
file permission for 'tmp' directory--------- drwxrwxrwx

Code I used to upload file :

DiskFileUpload upload = new DiskFileUpload();
List items = upload.parseRequest(request, 1024*1024*2, 1024*1024*4, getServletContext().getRealPath("/") + "tmp" );
Iterator itr = items.iterator();
while(itr.hasNext()){
FileItem item = (FileItem) itr.next();
if(!item.isFormField())
{
// the item must be an uploaded file
File tmp = new File(getServletContext().getRealPath("/") + "tmp");
File fullFile = new File(item.getName());
filename = item.getName();
File savedFile = new File(tmp, fullFile.getName());
item.write(savedFile);

can any one solve this problem
Please send your reply to infomarni0@yahoo.co.in
Thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 15 2004
Added on Jan 3 2004
1 comment
722 views