aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RMI problem with linux server and windows client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RMI problem with linux server and windows client" Watch "RMI problem with linux server and windows client" New topic
Author

RMI problem with linux server and windows client

Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Howdy Ranchers!

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?

Cheers!


OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5207
    
  12

I'll still stay with my advice: don't bother


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Andy Schmid
Greenhorn

Joined: Jan 14, 2009
Posts: 6
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.

Hope this helps
Andy
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Great Andy!

That was it, but I needed to change:

to


Thanks again :-)
Raf Szczypiorski
Ranch Hand

Joined: Aug 21, 2008
Posts: 383
Hi Pedro,

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.

Raf
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Thanks for your share Raf!

OT: Boy, oh boy I'm quite excited as I've just finished choices.txt and userguide.txt. Just check the javadoc again and I'm ready for submitting :-)
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5207
    
  12

Pedro Kowalski wrote:OT: Boy, oh boy I'm quite excited as I've just finished choices.txt and userguide.txt. Just check the javadoc again and I'm ready for submitting :-)

Good luck!
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Merci beaucoup
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI problem with linux server and windows client