Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

AccessControlException when use SecurityManager for RMI

843793Sep 7 2009 — edited Sep 7 2009
Hi,

I am following the JGuru RMI tutorials and while working on the Parametes tutorial;
http://java.sun.com/developer/onlineTraining/rmi/exercises/RMIParameters/index.html

I encountered the following exception when running the RMIServer part;
Parameters>java RMIServer
Registry created on host computer localhost on port 10002
Remote HelloService implementation object created
Exception in thread "main" java.security.AccessControlException: access denied (
java.net.SocketPermission 127.0.0.1:10002 connect,resolve)
        at java.security.AccessControlContext.checkPermission(Unknown Source)
        at java.security.AccessController.checkPermission(Unknown Source)
        at java.lang.SecurityManager.checkPermission(Unknown Source)
        at java.lang.SecurityManager.checkConnect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
ource)
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
ource)
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
        at sun.rmi.server.UnicastRef.newCall(Unknown Source)
        at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
        at java.rmi.Naming.rebind(Unknown Source)
        at RMIServer.<init>(RMIServer.java:75)
        at RMIServer.main(RMIServer.java:37)
To fix the problem I had to remove the following line of code from RMIServer.java;
System.setSecurityManager( new RMISecurityManager() );
Is there additional configuration I need to perform in order to use a security manager? I am running on Windows XP Pro.

Regards,

John
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 5 2009
Added on Sep 7 2009
1 comment
144 views