Cannot establish RMI connection to remote machine [duplicate]

青春壹個敷衍的年華 提交于 2019-12-31 04:02:09

问题


I can't seem to connect 2 machines using RMI. To make sure there wasn't something wrong with my code I copied the simple example from wikipedia (http://en.wikipedia.org/wiki/Java_remote_method_invocation) and I edited the code to print out a simple int.

I tried giving all permissions and turning all the firewalls off and I still get this error:

java.rmi.ConnectException: Connection refused to host 55.229.xx.xxx; nested 
exception is:java.net.ConnectException: Connection timed out: connect

I've been trying to do this for the past 3 days and I still can't seem to get past basic configuration problems.


回答1:


The Problem could be your RMI server is sending back its local address, instead of WAN address.

System.setProperty("java.rmi.server.hostname", *host IP*);

also take a look at security policies regarding RMI: http://docs.oracle.com/javase/tutorial/rmi/running.html




回答2:


Check your firewall settings on your aws instance RMI is running on 1099 port by default as i remember.



来源:https://stackoverflow.com/questions/17703719/cannot-establish-rmi-connection-to-remote-machine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!