This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

java.rmi.ConnectException: Connection refused to host

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

I am having a problem setting up RMI using WebSphere 5.1.1.10 on AIX. When I start the JVM, rebinding succeeds. However, when I go into the application and make an RMI call, here is the error message I am seeing:

-------------------------

[12/8/06 16:11:10:498 UTC] 3e141124 SystemErr R java.rmi.ConnectException: Connection refused to host: 159.202.158.9; nested exception is:
java.net.ConnectException: Connection refused
[12/8/06 16:11:10:499 UTC] 3e141124 SystemErr R at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:585)

-------------------------

The two servers are 158.8 and 158.9

rmiregistry is running on port 1099 on both, when I netstat -an I see port 1099 listening on both. rmiregistry was started before the JVM came up. Also if I telnet to 159.203.158.9 1099 from 158.8, it works, and vice versa.

Going crazy here. Any ideas?
[ December 08, 2006: Message edited by: Chad Naber ]
 
Chad Naber
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I determined what the problem is here, and I thought I would post the solution for everyone's reference:

There is a problem with AIX machines that have 2 NICs and IBM WebSphere.
If you have 2 IPs on the AIX machine, WebSphere uses the first IP in the hosts file for rmiregistry regardless of the rmi deployment descriptors.

The fix is to use these parameters
when starting rmiregistry:

#rmiregistry 1099 -Djava.rmi.useLocalHostName=true
-Djava.rmi.server.hostname=ipaddressofthismachinerunningrmi

The ip address is the local ip of the host computer in the \etc\hosts\ file.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!