MachineA which is the client is multi homed and has two IP's, IP1, and IP2. IP1 is not accessible to MachineB. MachineB also cannot resolve the machine name 'MachineA' as it does not have and entry in its host file mapping MachineA to its public IP.
When the client on MachineA makes a call to the server on MachineB, the server gets the name "MachineA" in the transport layer (when activemq logging it turned on) which it cannot resolve. I could add an entry in Machine B's host file associating the name MachineA with the public IP of MachineA however AFAIK the RMI solution of setting java.rmi.server.hostname does not require changes to the host file because if I had passed -Djava.rmi.server.hostname=<machine a's public IP> when starting the JVM on Machine A, then this value is used durning communication with the server. as a result Machien B would see MachineA's public IP. With Lingo / Active MQ, passing -Djava.rmi.server.hostname=<machine a's public IP> on the MachineA's JVM doesnt help as "MachineA" is still sent to the server which it cannot resolve. I did a quick test passing - Djava.rmi.server.hostname=<machine a's public IP> and calling InetAddress inetaddress = InetAddress.getLocalHost(); String hostName = inetaddress.getHostName(); the hostName returned is still "MachineA" and not the one overridden by " java.rmi.server.hostname". So I think that ActiveMQ is just calling InetAddress.getLocalHost() which does not end up using the "java.rmi.server.hostname" override. Did I get anything wrong with my understanding of this? Thanks, Sanjiv On 1/20/07, Bruce Snyder <[EMAIL PROTECTED]> wrote:
On 1/20/07, Sanjiv Jivan <[EMAIL PROTECTED]> wrote: > I am using Lingo / ActiveMQ for client server communication an ran into an > issue with multihomed machines. When the client is on a multihomed machine > and sends a request to the sever, the server is not able to communicte back > to the client because the client passed the internal / non public IP when > communicating with the server. > > With RMI, I used to set the System property java.rmi.server.hostname to the > public IP of the multihomed machine and when this is set, Java RMI uses this > value instead of the one returned by java.net.InetAddress (see > http://java.sun.com/j2se/1.4.2/docs/guide/rmi/javarmiproperties.html). > > Is there a similar setting for use with Active MQ? If not, how do you > suggest we resolve this problem. AFAIK, the -Djava.rmi.server.hostname=<ip-address-of-public-interface> should work as long as the /etc/hosts file is configured properly (the caveat to this is the use of DHCP on the primary interface). What are the entries for the hostnames of these machines in their respective /etc/hosts files? Bruce -- perl -e 'print unpack("u30","D0G)[EMAIL PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*" );' Apache Geronimo - http://geronimo.apache.org/ Apache ActiveMQ - http://activemq.org/ Apache ServiceMix - http://servicemix.org/ Castor - http://castor.org/