开发者

Trouble running RMI application in Java

I am following this tutorial about Java RMI http://download.oracle.com/javase/tutorial/rmi/TOC.html

However when I try to start the server I receive the following error:

ComputeEngine exception: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 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.(Unknown Source) at java.net.Socket.(Unknown Source) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source) 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 engine.ComputeEngine.main(ComputeEngine.java:61)

I am trying to run with the following command:

D:\files\develop\javarmi>java -cp D:\files\develop\javarmi;D:\files\webdocs\classes\compute.jar -Djava.rmi.server.code开发者_如何学JAVAbase=file:/D:/files/webdocs/classes/compute.jar -Djava.rmi.server.hostname=192.168.0.162 -Djava.security.policy=server.policy engine.ComputeEngine

What should I do to correct this issue?


Problem solved.

The server.policy file was wrong the correct is this:

grant { permission java.net.SocketPermission "*:1024-", "connect,accept"; permission java.security.AllPermission; };

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜