File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Weird problem with rmi 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 "Weird problem with rmi" Watch "Weird problem with rmi" New topic

Weird problem with rmi

Jason Fritz

Joined: Jun 07, 2006
Posts: 4

I was performing some test in the B&S assignment and I came up with a problem with the client/server (based on RMI) that I'm not able to solve.

All the development has been made on a linux computer with JDK 1.4.2. The network testing is done using the same linux-based machine and a WindowsXP-based machine using JRE 1.5.0_06.

In the first scenario, server is run in the windows machine and client in the linux machine and everything works perfectly.
However, when I use a second scenario, i.e. the server running on the linux-machine and the client running in the Windows machine a weird problem occurs:

The client cannot connect to the server and a UnmarshallException occurs. Moreover, it says that the client is trying to connect to localhost ( instead to the given IP (passed to the Naming.lookup() function).

To be honest I'm totally lost with this problem since it seems to work in one direction but not in the other direction. So any advice/guidance will be very welcome.

Thanks in advance,
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
Had the same problem with Linux initially.
It's caused by many Linux distributions putting a hard reference to as localhost in the /etc/hosts file.
Comment out that entry and restart the server, all should be well.

Jason Fritz

Joined: Jun 07, 2006
Posts: 4
Thanks a lot,

In fact I was tinking in the same direction as your solution (linux distribution was ubuntu - so debian based), because the same compiled code was working properly when connecting two windows based machines and also on a mac (with os 10.4). So I was guessing that it had something to do with the name resolution.

As said, thanks for your answer.
Saheed Adepoju
Ranch Hand

Joined: Jun 23, 2004
Posts: 267
Just a thought, i figured using 1.4.2 is actually kinda late cause it has been 18 months since its realease. Shoudnt you be testing/working with Jdk 5.0 or is simply using the JRE(1.5) enough. Anyways just an observation

Saheed Adepoju<br />SCJP 1.4<br />SCJD (B&S..In progress)
I agree. Here's the link:
subject: Weird problem with rmi
It's not a secret anymore!