File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
Problems with Java RMI when having multiple IPs (private IP and public IP)
Joined: Dec 22, 2002
Jul 10, 2011 20:39:14
I have a RMI client, needs to add private IP adapter for cluster purpose. it communicates with RMI server at different machine.
IP config is this:
C:\>ipconfig Windows IP Configuration Ethernet adapter Local Area Connection 2: Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::c969:3f78:3190:1f1c%11 Autoconfiguration IPv4 Address. . : 169.254.31.28 Subnet Mask . . . . . . . . . . . : 255.255.0.0 Default Gateway . . . . . . . . . : Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : io.fc.hp.com Link-local IPv6 Address . . . . . : fe80::1dbe:2ffd:f06a:9a56%10 IPv4 Address. . . . . . . . . . . : 220.127.116.11 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 18.104.22.168
169.254.31.28 is a private IP. 22.214.171.124 is public IP.
Before I added this private IP. RMI client and Server communicate all right.
But After i added this private IP.
my client filed on a method call: servicesRef.getPaciVersions();
Registry reg = LocateRegistry.getRegistry(connection.hostname, Integer.parseInt(connection.port), factory); String providerName = findRegName(reg.list(), PROVIDER_NAME); ServiceNameProvider servicesRef = (ServiceNameProvider) reg.lookup(providerName); String paciVersions = servicesRef.getPaciVersions();
I debugged servicesRef object. its host is this private IP address (169.254.31.28). Before it was public IP,
so this call threw a IO exception.
I am not sure only why this host only has this private IP, no public IP. After I removed this private adapter, host has public IP.
my server RMI side. the code like this:
String name = "rmi://" + hostname + ":" + RmiPort + "/" + PROVIDER_NAME; LocateRegistry.createRegistry(RmiPort, SSLSocketFactoryCreator.getInstance(), SSLSocketFactoryCreator.getInstance()); Registry reg = LocateRegistry.getRegistry(hostname , RmiPort, SSLSocketFactoryCreator.getInstance()); PaciVersionService paciVesionService = new PaciVersionService(RmiPort); reg.rebind(name, paciVesionService);
not sure why paciVesionService contains only private IP address. my code seems not do it.
I agree. Here's the link:
subject: Problems with Java RMI when having multiple IPs (private IP and public IP)
How to know programmatically whether a machne is in Global/Private network ?
Apache not working when connected to Wireless LAN
RMI problem with Localhost
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015