Solved

FilePermission Access Denied Error

Posted on 2004-04-02
3
262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

626 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