If the server address is being translated, you've got a problem. Most implementations of RMI servers embed the server address and port in the client proxies. The client then receives a remote object (actually a proxy implementing Remote) which contains the server's private address. The NAT router doesn't have anyway to translate the address embeded in the proxy. So when the client attempts to use a method of the remote object, the request is sent to the server's private address.
There are two general solutions to this problem:
- Use an RMI proxy server which will receive the request on a public address and forward it to the server's private address. Search the list archives of announcements of RMI proxy servers.
- Modify the proxies or RMI server to embed or translate the server's private address to the public one. Most servers will allow you to specify a RMIClientSocketFactory. A quick hack that has worked for me in the past is to implement a RMIClientSocketFactory that translates the address it's given in the createSocket method to the public address, then creates a socket using the public address.
--Victor
deepak wrote:
I am trying to connect to the EJB Server from a rmi client and there is NAT(Network Address Translator) in between. Due to this NAT , this thing doesnt work. Any idea how i can work this out.Thanks. Deepak.
