Start New Discussion within our Software Development Community

hi all
i have start working on java rmi currently.i using this tutorial to write my first java rmi program.
http://www.javacoffeebreak.com/articles/javarmi/javarmi.html

i started the rmiregistry.then i compile server file and generate the stub file using rmic.Now when i am running the server using java command it is giving following exception

Exception in thread "main" java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
at java.net.Socket.connect(Socket.java:512)
at java.net.Socket.connect(Socket.java:468)
at java.net.Socket.<init>(Socket.java:365)
at java.net.Socket.<init>(Socket.java:179)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at java.rmi.Naming.bind(Naming.java:111)
at PowerServiceServer.main(PowerServiceServer.java:57)

please help me out of this.

Do you have the appropriate permissions for creating a server socket on your machine? Are you the administrator? Have you made any changes to your default policy file?

Also, it seems you are using a very old tutorial. You don't need a "rmic" compiler these days. Read the official RMI tutorial and post if you are facing any issues.

This article has been dead for over six months. Start a new discussion instead.