Solved

FilePermission Access Denied Error

Posted on 2004-04-02
3
247 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
3 Comments
 
LVL 14

Accepted Solution

by:
Tommy Braas earned 125 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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 learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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 …

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now