The Artima Developer Community
Sponsored Link

Java Answers Forum
Error: java.security.AccessControlException: access denied

2 replies on 1 page. Most recent reply: Jun 7, 2003 10:13 AM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
shelby

Posts: 1
Nickname: shelbytll
Registered: May, 2003

Error: java.security.AccessControlException: access denied Posted: May 19, 2003 8:54 AM
Reply to this message Reply
Advertisement
Hi, I am using an FTP code as an Applet. The applet will try to connect to the domain where the applet came from. I alsoo get my jar file signed with the following command:
jarsigner -keystore ftpstore -storepass ftppwd -keypass ftppwd -signedjar ftpsigned.jar ftp.jar ftp

So when I run the applet, it prompt me to grant. So I grant it.

So what the applet is trying to do is to:
1. connect (successful)
2. list directory (with system.out.println) (successful)
3. upload a file to the ftp server (UNsuccessful)

The error was:
java.security.AccessControlException: access denied (java.io.FilePermission C:\test2t.txt read)

So I tried to edit my java.policy file and append the following line:
permission java.io.FilePermission "c:\\test2.txt", "read,write,execute,delete";

Then I restart my web server but the error still persist...

What can I do?


Naveen Lade

Posts: 2
Nickname: naveenlade
Registered: Jun, 2003

Re: Error: java.security.AccessControlEx ception: access denied Posted: Jun 5, 2003 1:52 AM
Reply to this message Reply
Friend,

I think u r modifying a wrong policy file.
U shld be modifiying the security.policy file.

Do it this way.

Create a file policy.txt with the following contents:
********************************************************
grant {
permission java.security.AllPermission "", "";
};
**********************************************

execute the class with the following options :

java -Djava.security.policy=policy.txt <class name >

This shld help.

IF something still persists, give me a mail at
naveen.lade@polaris.co.in

-Naveen

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Error: java.security.AccessControlEx ception: access denied Posted: Jun 7, 2003 10:13 AM
Reply to this message Reply
3. upload a file to the ftp server (UNsuccessful)
because an applet is not able to read files on the user's hard drive.

Sounds like you are trying to grant permission to one file, but programmatically asking for any file.

Flat View: This topic has 2 replies on 1 page
Topic: function help Previous Topic   Next Topic Topic: how to execute a servlet program through the browser

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use