Re: Does RMI Connector works over NAT

"Simone Bordet" <[email protected]>
Newsgroups gmane.comp.java.mx4j.user
Message-ID <[email protected]>
Hi,

> In my application deployment scenario, device running MX4J MBeanServer with
> RMIConnector is behind the NAT(Network Address Translator). Hence the device
> ip address is for example 10.1.1.1 and its RMI URL using which RMIConnector
> registers is:
> service:jmx:rmi://10.1.1.1/jndi/rmi://10.1.1.1:1099/jmxconnector

You mean the RMIConnectorServer, not the RMIConnector, right ?

> IP address of this device to access it from outside world is for example
> 172.27.1.10 and hence Client side RMIConnector has to use following RMI URL:
>
> service:jmx:rmi://172.27.1.10/jndi/rmi://172.27.1.10:1099/jmxconnector
>
> In this case, client is not able to connect to server, is there any solution
> to this problem. How do we make RMIConnector work across NAT.

I think this is a generic RMI problem, so you can also google
information on RMI/NAT.
Try to set the system property:

-Djava.rmi.server.hostname=172.27.1.10

on server side, before starting the RMIConnectorServer. This should
associate the WAN address to the stub, instead of the internal
address.

Also, note that for the RMIConnector and RMIConnectorServer, the host
name in JMXServiceURL is totally ignored, so:

service:jmx:rmi://172.27.1.10/jndi/rmi://172.27.1.10:1099/jmxconnector

is completely equivalent (and probably less confusing) to:

service:jmx:rmi:///jndi/rmi://172.27.1.10:1099/jmxconnector

Simon
--
http://bordet.blogspot.com


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.