Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

FilePermission Access Denied Error

Posted on 2004-04-02
3
Medium Priority
?
270 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 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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…
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 …
Suggested Courses

705 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