File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes java.rmi.ConnectException 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 "java.rmi.ConnectException" Watch "java.rmi.ConnectException" New topic
Author

java.rmi.ConnectException

Akash Singh
Ranch Hand

Joined: Aug 21, 2003
Posts: 80
I am at final stage for submission of old FBN assignment.
I am testing on Linux and Windows 2000.
Case 1:
RMI Server is running on Window 2000 and Client is running on Linux.
I am able to connect.
Case 2:
RMI Server is running on Linux and Client is running on Window 2000 .
When I try to connect to RMI Server, I get the error message
java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested excepti
on is:
java.net.ConnectException: Connection refused:

I have added the ip address of the linux machine in /etc/hosts file.


I did netstat -an after starting the RMI server,
it shows that RMI service is running on 1099.

Is there any thing else I am missing?

Regards,
Akash
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11525
    
100

Hi Akash,
You did restart your server after changing the /etc/hosts file didn't you?
I am suspicious that it is trying to connect to IP address 127.0.0.1 - are you sure you entered the correct address on the client side?
When you ran the server on Windows and the client on Linux, you didn't accidentally have a server running on Linux at the same time did you?
Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Akash Singh
Ranch Hand

Joined: Aug 21, 2003
Posts: 80
Still not able to connect. I looked into all your suggestions.
I have no firewall on Linux machine. I can telnet to linux machine.
I do not have any connection problem. But still i am not able to connect
to RMI server on Linux from windows 2000.
I have a question. In my current client code to get the ref
of remote object, i have

Will it make any difference,if I change it to:


Regards,
Akash
K Madan
Greenhorn

Joined: Apr 08, 2004
Posts: 10
Case 2:
RMI Server is running on Linux and Client is running on Window 2000 .
When I try to connect to RMI Server, I get the error message
java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested excepti
on is:
java.net.ConnectException: Connection refused:
It seems Client is trying to find server on localhost, please check client lookup properties DNS name value ??
it might help
Kmadan
Akash Singh
Ranch Hand

Joined: Aug 21, 2003
Posts: 80
Thanks Andrew and Kmadan.
Finaly, I got through the problem.
Actually solution to this problem
java.rmi.server.hostname property.
As of JDK 1.3.1 this property is set to localhost, and my localhost is
127.0.0.1 on linux and actual ip address is 192.169.1.102, name is Akash in /etc/hosts file. Therfore, Windows 2000 client was always trying to connect to 127.0.0.1 on linux. I think this is a problem on Linux.
When i started started RMI server on Linux as:
java -Djava.rmi.server.hostname=Akash -jar DataServer-with-DataServerUI.jar
I was able to connect to RMI server on Linux from windows 2000 RMI client.

Thanks again to you guys.
Regards,
Akash
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.rmi.ConnectException