piątek, 14 czerwca 2013

RMI headache - (too) many network interfaces

Assuming we have more then one network interface on our machine and assuming they are no routeable each other you can be faced a wierd behavior of RMI RemoteObject.

If you use TCP protocol as a transport creating an object of UnicastServerRef underneeth there is LifeRef object created, which in turn calls TCPEndpoint.getLocalEndpoint() method.

getLocalEndpoint() implementation do the following:
  • creates TCPEndpoint object with null value passed as hostname
  • resamples local host
return AccessController.doPrivileged(new GetPropertyAction("java.rmi.server.hostname"));

So make sure it points to the proper one ;).

Brak komentarzy:

Prześlij komentarz