Solved

java.security.AccessControlException: access denied

Posted on 2006-11-10
4
570 Views
Last Modified: 2008-01-09
Hi Experts,

I am trying to run Chat sample program and have this “java.security.AccessControlException: access denied “ error.

After searching for the cause, it looks like I need to modify one of the java security files, but I don’t have much clue. Can somebody help me on this?

Thanks,

+++++++++
java.security.AccessControlException: access denied (java.net.SocketPermission 1
27.0.0.1:1099 connect,resolve)
        at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:269)
        at java.security.AccessController.checkPermission(AccessController.java:
401)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
        at java.lang.SecurityManager.checkConnect(SecurityManager.java:1026)
        at java.net.Socket.connect(Socket.java:446)
        at java.net.Socket.connect(Socket.java:402)
        at java.net.Socket.<init>(Socket.java:309)
        at java.net.Socket.<init>(Socket.java:124)
        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirect
SocketFactory.java:22)
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMaster
SocketFactory.java:128)
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185
)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
        at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
        at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
        at java.rmi.Naming.rebind(Naming.java:160)
        at RemoteModel.setOnline(RemoteModel.java:155)
        at RemoteModel.setModelName(RemoteModel.java:136)
        at ChatRoom.setSubject(ChatRoom.java:119)
        at ChatRoom.<init>(ChatRoom.java:54)
        at ChatRoom.main(ChatRoom.java:194)
0
Comment
Question by:dkim18
[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
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
Peter Kwan earned 350 total points
ID: 17919791
Please see if the following suits your need:

http://archives.java.sun.com/cgi-bin/wa?A2=ind0006&L=rmi-users&P=29236
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17919917
you can't connect/resolve from the applet. if you want to do so, you need to sign the applet and distribute
0
 

Author Comment

by:dkim18
ID: 17922100
pkwan,

I added these line in java.policy file:

permission java.net.SocketPermission "localhost:1099","accept,connect,resolve,listen";
permission java.net.SocketPermission "*:1099","connect,accept,resolve";

but still having error:

C:\P3_1>java ChatRoom Nutrition Vicki
java.security.policy: error parsing file:/C:/Java/j2sdk1.4.2_09/jre/lib/security
/java.policy:
        line 1: expected [;], found [permission]
java.security.AccessControlException: access denied (java.net.SocketPermission 1
27.0.0.1:1099 connect,resolve)
        at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:269)
        at java.security.AccessController.checkPermission(AccessController.java:
401)
...
...
...
0
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 17923968
You should put the lines into grant block:

example:

grant {
permission java.net.SocketPermission "localhost:1099","accept,connect,resolve,listen";
permission java.net.SocketPermission "*:1099","connect,accept,resolve";

}
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hibernate example issues from command prompt 10 82
Chrome and Firefox Java 5 86
wild fly 8 startup error 2 74
using executorService 3 15
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…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

739 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