当前位置: 代码迷 >> J2SE >> Java的RMI只能本地调用,放到服务器上就无法调用,该怎么处理
  详细解决方案

Java的RMI只能本地调用,放到服务器上就无法调用,该怎么处理

热度:113   发布时间:2016-04-24 00:55:13.0
Java的RMI只能本地调用,放到服务器上就无法调用
请问应该如何配置安全策略才能访问服务器的远程对象?
Java code
Exception in thread "main" java.security.AccessControlException: access denied (java.net.SocketPermission 192.167.14.168:1199 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 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.lookup(Unknown Source)    at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)    at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)    at javax.naming.InitialContext.lookup(Unknown Source)    at com.safari2s.rmi.client.ProductClient.main(ProductClient.java:31)


------解决方案--------------------
测试端口通吗
telnet 192.167.14.168 1199
  相关解决方案