java.rmi.ConnectException: Connection refused to host: IPSERVER0.0.0.0.0; nested exception is:
java.net.ConnectException: Connection timed out
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:340)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:101)
at StartRMI.go(StartRMI.java:14)
at StartRMI.main(StartRMI.java:6)
Caused by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:208)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:146)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 7 more
当我尝试将远程客户端连接到服务器时,我收到此异常。我的服务器正在运行RMI服务器,并且没有安装防火墙。如何解决这个问题?
答案 0 :(得分:1)
检查所有网络适配器,有时VM网络适配器会以这种方式干扰。
您当前的localhost
或127.0.0.1
是哪个更不是指您的主机名或当前计算机,然后创建连接被拒绝的问题。我的一般建议是:
1.To check or disable unwanted VM or Network Adapters
2.Ping 127.0.0.1
3.Disable Firewall and Test if all the above doesn't work
4.Add security Manager with a policy file on you server if you haven't done that.
答案 1 :(得分:0)
您还没有提到您正在使用哪个操作系统,如果在代码和防火墙方面一切正确,那么您可能需要检查主机条目或IP表规则。
答案 2 :(得分:0)
IPSERVER是否在/ etc / hosts文件中映射到您想要的IP地址?
检查执行hostname -i
或hostname
时的效果。
尝试输入您的IP地址而不是域名。
答案 3 :(得分:0)
尝试使用
启动RMI注册表start rmiregistry
表示默认端口或
rmiregistry <port_no>
表示指定的端口。