I'm having the same problem--not with the example, but with my own application.
I get this problem from my client machine. The JBoss server is running on a W2K machine that has two NICs--each with it's own subnet (one internal [10.0.0.?], and the other external). The client machine is on the internal subnet, but the naming service is returning the external subnet's ip address of the other card. When the naming lookup process tries to open a socket to the returned ip address, the error mentioned above occurs. The error makes sense, because I have intentionally made it so that the two subnets can not talk to each other.
I have spent a signicant amount of time trying to get the naming service to only be used on the internal subnet, but I have been unsuccessful. I tried using the BindAddress attribute for the naming service, but that did not fix the problem (it's possible that I did not use the BindAddress attribute properly--I couldn't find any documentation, so I just entered the ip address of the internally defined NIC).
Does anyone know how force the naming service to use (and return) only one ip address when the server actually has two?
This is in FAQ forum
Have a look at connection refused to host 127.0.0.1
The posting in the FAQ forum was instructive, but I still always get the java.rmi.ConnectIOException. I believe I am dealing with a bug in the naming provider.
My client machine is 10.0.0.51. When I get my initial context, I have proved that I am using a "java.naming.provider.url" value of 10.0.0.17, but I always get the above exception trying to open a socket of 220.127.116.11, which is the ip address of the other card in my JBoss server. Since they are on different subnets, I know that I am hitting the JBoss machine, because there is no way that 10.0.0.51 could even know of or discover 18.104.22.168.
If I attempt to connect to the JBoss server when JBoss is shut down, then I get a java.net.ConnectException. If JBoss is running, and the naming service has been bound to 10.0.0.17, I get the same ConnectIOException telling me that it can't open a connection to 22.214.171.124. If I bind the naming service to 126.96.36.199, I get the java.net.ConnectException exception.
When I disable the 188.8.131.52 ip address and try to connect to JBoss from 10.0.0.51, I can successfully get my initial context.
So, any time I have both ip addresses enabled on my JBoss server, it always returns the ip address of the card on the other, external, subnet--even though the client request was made across the internal subnet with the "java.naming.provider.url" set to the internal subnet's ip address of the JBoss server (when I say return, I mean to the jnp-client code path).
By the way (in case I caused anyone shock), 184.108.40.206 is just a made-up ip address used for this discussion only.
Did you set the hostname property?
rmi binds to one ip address, whatever it thinks is
If you use hostnames instead, you can use
the client's host table (or a dns on each sub-network)
to bind the host name to the correct ip address for
on 10.0.0.* it points to 10.0.0.17
elsewhere it points to 220.127.116.11
As I continued to research, I eventually came back to the topic referenced above, and finally I realized that I had not picked up on the -Djava.rmi.server.hostname entry. So, as instructed, I set it to
-Djava.rmi.server.hostname=10.0.0.17 and it worked perfectly.