java.rmi.Remote - get IP on which object is exported
I use
UnicastRemoteObject.exportObject(this);
to export an object that implements java.rmi.Remote. Then I send this object (wrapped in a MarshalledObject) via an ObjectOutputStream to an application in another JVM (i.e. give it a callback to call my application's methods).
In case there are several network adapters there may be need to setup java.rmi.server.hostname property to ensure that the socket given for backward connection (the socket on which the object is exported) to the remote application is bound to an IP that is reachable from the remote machine.
Is there a way to determine at time of export on what IP (and possibly port) is the object exported? In the debugger I see that the Remote (the stub) returned by the call to exportObject contains a reference to a TCPEndpoint instance that contains this information, but is there a way to reach this information without reflection?
I want to log this information on the side that exports the object so that I can analyze possible reasons for callback functionality failure.
Thanks
Mike

