Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
RMI issue when changing networks -- doesn't occur with soylatte
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RMI issue when changing networks -- doesn't occur with soylatte



Hi everyone, I have two RMI apps that run only on the local host. Call them the client and server--the server starts up the RMI registry, but otherwise they are pretty much the same, sending messages to each other. These apps have worked fine for years but there are issues when you change networks...for example, if you are on a laptop and you go from home to work. If the two apps have already been started, they can no longer communicate with each other after the network change. Neither client nor server can send messages to each other.

I managed to fix half of this problem, by adding:

System.setProperty("java.rmi.server.hostname","127.0.0.1");

to both apps. Now I can communicate between server and client after the network change, but not the other way: that results in a timeout.

I have reason to believe this is an Apple JVM issue. It happens with both 1.5 and 1.6 (1.6.0_17) under Leopard, however, it does not happen using the latest SoyLatte (1.0.3) jvm. Under SoyLatte, the first RMI method call after the network change takes about 45 seconds, but after that, it works fine. Unfortunately, using the SoyLatte JVM is not a practical workaround for me for a variety of reasons.

I also added some logging to both apps with:
System.setProperty("java.rmi.server.logCalls", "true");

I can see in the client that it is correctly using 127.0.0.1 as the RMI server:
FINER: RMI TCP Connection(1)-127.0.0.1: [127.0.0.1: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]

However, after the network change, I see this in the client console:
java.rmi.ConnectException: Connection refused to host: 10.10.6.101; nested exception is:
java.net.ConnectException: Operation timed out

It looks like RMI "forgets" that it is supposed to use 127.0.0.1, and goes back to the IP that was assigned to the machine when the RMI connection was initially made.
Of course, that IP has changed since the computer is now on a different network.
Supposedly, setting the java.rmi.server.hostname property is supposed to prohibit this behavior, but it looks like that doesn't work consistently.

Can anyone shed any light on this?
Thanks


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.