This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I've bumped into some very nasty problem regarding mixing of MS Windows and GNU/Linux.
Basicaly, I'm developing in Linux for all the time, so I've tested my application mainly on Ubuntu, but hey - there is the real world in which Windows clients exists to ;-)
So that's the problem:
Linux client <-> Linux server
Linux client <-> Windows server
Windows client <-> Windows server
Windows client <-> Linux server
Apparently, when Windows client tries to connect to the Linux server it successfully establishes the connection and gets the remote object, but every action executed on that remote object ends with ConnectionException. It shows that the Windows client tries to connect with 127.0.1.1 , despite the IP typed in the settings panel was my local IP 192.168.1.5.
I've noticed that someone have similar problem more than a year ago (here). I know that Roel suggested to leave it like that, but this bug really pisses me off ;-)
Maybe somebody experienced the same problem and know how to solve it?
According to your brief description i think i faced the same problem when i tried RMI Linux (Ubuntu 10.04) Server with Windows Client. See these inks regarding this RMI binding issue - which is probably the issue you are seeing:
Java RMI: Connection refused From the official RMI FAQ:
Sun RMI FAQ A.1
I fixed it by changing the 127.0.1.1 /etc/hosts entry :
127.0.1.1 localhost --> not working
127.0.1.1 <Real hostname> --> working
I have seen this issue also on Windows RMI Server if multiple IPs are configured on the Windows box.
I had the very same problem as you have, and I searched and found a fix that doesn't involve messing around with /etc/hosts or whatever.
That's what I wrote in instructions.txt:
If the server is accessed by computers on the Internet, it might not work
without additional network configuration. To make it always work, the simplest
way would be to use the 'java.rmi.server.hostname' property - simply set it to a
hostname / IP of the server computer that is accessible by all clients, like:
java -Djava.rmi.server.hostname my.host.com -jar runme.jar server
and this in choices.txt:
- when the server and client are located on the same machine, the communication
will always work; when they are two different machines, whether the connection
works depends on configuration of the network, but it can always be made to
work when the server is started with the java.rmi.server.hostname property set
to the ip / hostname of the server that is accessible by the clients; this is
a specific feature of RMI; please note that this property is not required to
start the application, so it is compliant with the specs; this tip is also
mentioned in the user guide
By noting that this property is not required, but rather optional to make it work on machines in the network (be it local or the internet, tested all possibilities), I made sure I don't fail automatically, but I also had the piece of mind that I know how to fix it correctly. Apparently, it didn't bite me in the ass as I passed.