Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

FilePermission Access Denied Error

Posted on 2004-04-02
3
Medium Priority
?
275 Views
Last Modified: 2010-08-05
I signed up for a service with a web host. The run Tomcat 4.  I uploaded a oriely jar file for use in File Upload process.
I don't have direct access to policy files so I can't make any changes to them.
I keep getting
java.security.AccessControlException: access denied (java.io.FilePermission /tmp read)
      at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
      at java.security.AccessController.checkPermission(AccessController.java:401)
      at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
      at java.lang.SecurityManager.checkRead(SecurityManager.java:887)
      at java.io.File.isDirectory(File.java:698)
      at com.oreilly.servlet.MultipartRequest.(MultipartRequest.java:140)

I tried changing the FilePermission on /tmp directory to "write" using java.io.FilePermission.  But no success.
My JSP code looks like this:
<%@ page import ="java.util.*" %>
<%@ page import ="java.text.*" %>
<%@ page import ="java.net.*" %>
<%@ page import ="com.oreilly.servlet.MultipartRequest" %> -- This is the package that I use for file upload.
<%@ page import = "javax.servlet.http.HttpUtils" %>
<%@ page import = "java.io.*" %>
<%
   String temp_path = "";
            temp_path="/tmp/";
            FilePermission fp = new FilePermission(temp_path , "write");
            out.print(fp.getActions());
   MultipartRequest multi=new MultipartRequest(request, temp_path, 41 * 1024 * 1024);

I'm still getting the error and I'm not sure what else to do.
Please help.
0
Comment
Question by:mhson1978
1 Comment
 
LVL 14

Accepted Solution

by:
Tommy Braas earned 500 total points
ID: 10744191
You need to change the policy file of your Tomcat instance AND make sure that /tmp really exists and that you have write access to it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question