Skip to Main Content

Java APIs


For appeals, questions and feedback about Oracle Forums, please email Please ask technical questions in the appropriate category. Thank you!

RMI over two paths, one NAT'd

1058330Dec 4 2013 — edited Dec 12 2013


I'm working on a server which interfaces with various types of clients:

- "Full featured clients" may only be able to see a load balancer / firewall VIP; the server IP may be NAT'd from them.

- "Admin clients" typically connect directly to the server.

It's very surprising that RMI / NAT is not handled better by Java.  Have seen various postings with references to 'java.rmi.server.hostname'.  However, it applies to the entire server process so won't work here.

Instead, I noticed that a single call to Registry.lookup() serializes multiple instances of RMIClientSocketFactory to the client (i.e. with different stack traces):

1) In the first instance, the host parameter of RMIClientSocketFactory.createSocket() is the VIP.

2) In future instances, it is the server's IP.

The solution that appeared to work for me is to use the host from that first instance in all future calls to RMIClientSocketFactory.createSocket().

Has anyone encountered this situation?  Did you find any better alternatives?

Thanks in advance.

Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 9 2014
Added on Dec 4 2013