Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

java.rmi.ConnectException

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Akash Singh
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic