Re: RMI & connection refused
"Duane Evenson" <duane@invalid.address> wrote in message
news:pan.2009.08.02.03.22.41.285284@invalid.address...
I'm suffering from the the common "java.rmi.ConnectException: Connection
refused to host" problem.
[...]
Can anyone help -- not just for me -- but for all the rest looking for a
definitive answer to what's going on and how to fix it?
Thanks!
Java RMI is not particularly firewall-friendly. If you are running Windows,
you need to open ports to allow RMI to pass. Note that the RMI registry is
one service, and each object you publish is another service, accepting
connections on arbitrarily assigned ports (by default). These arbitrarily
assigned ports are a problem for firewall admins, because you don't know in
advance which port the objects will be listening on.
One of the reasons for the RMI Registry is to give you a one-stop-shop for
your arbitrarily assigned service ports, but it doesn't solve the firewall
problem. You can create a custom RMI socket factory that will create server
sockets on specifically assigned ports.
http://java.sun.com/j2se/1.4.2/docs/api/java/rmi/server/RMISocketFactory.html
If you are running Windows, temporarily try turning off the Windows firewall
on both the RMI client and RMI server. If it works, then you have identified
the problem (no, not the firewall...).