[英]Connection refused error in java RMI
I've created an RMI service that includes some method calls from another computer. 我创建了一个RMI服务,其中包括来自另一台计算机的一些方法调用。 Server and client have valid IP addresses and when I try to run the program in the client I get a
connection refused
exception. 服务器和客户端具有有效的IP地址,当我尝试在客户端中运行程序时,出现
connection refused
异常。
When I change the IP address to localhost it will solve my problem, but when I try remote to another IP address the same error occurs. 当我将IP地址更改为localhost时,它将解决我的问题,但是当我尝试远程访问另一个IP地址时,会发生相同的错误。
There are three cases of 'connection refused' in RMI: RMI中存在三种“连接被拒绝”的情况:
bind()/rebind()/unbind()
. bind()/rebind()/unbind()
。 The Registry isn't started at the host:port or URL you're using. lookup()
. lookup()
。 If (1) succeeded, you're trying to lookup the wrong Registry. java.rmi.server.hostname
at the server JVM before exporting any remote objects. java.rmi.server.hostname
。 See the RMI FAQ item A.1 for why. hosts
file. hosts
文件。 Try use this before register rmi 尝试在注册rmi之前使用它
System.setProperty("java.rmi.server.hostname", REGISTRY_HOST); System.setProperty(“ java.rmi.server.hostname”,REGISTRY_HOST);
here REGISTRY_HOST is the ip address. 这里REGISTRY_HOST是IP地址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.