Solved

java.security.AccessControlException: access denied

Posted on 2006-11-10
4
513 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
  • 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
json example 39 114
word0 challenge 4 53
@SBGen Method 3 25
Checkbox and ListView in Android Layout 4 39
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now