Solved

java.security.AccessControlException: access denied

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn different types of Android Layout and some basics of an Android App.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

728 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