Solved

FilePermission Access Denied Error

Posted on 2004-04-02
3
253 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
splitOdd10 challenge 5 108
How to execute a Python program and gather return output in Java 2 31
null output 3 25
CSV file parsing thru Java 13 31
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

809 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