Re: RMI & connection refused
"Duane Evenson" <email@example.com> wrote in message
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?
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.
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...).