A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Node.js in Action
this week in the
Developer Certification (SCJD/OCMJD)
java.net.ConnectionException Connection refused to: hostname problem with Linux and Windows solution
Joined: Jul 24, 2008
Jun 27, 2009 22:36:59
I found out that some of you have had problems with this, and believe it or not this is not an RMI issue and does not involve Java code.
The problem is the Linux machine. To make it work I had to do the following:
First open the port in the Linux machine using the following iptables command as root:
iptables -A OUTPUT -p tcp -d 0/0 -s 0/0 --dport 1099 -j ACCEPT
iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 1099 -j ACCEPT
after that you have to check your hostname file and see what is it:
for instance my hostname was:
next you have to specify this name as the name to retrieve when someone asks you for your hostname. This can be done modifying your /etc/hosts file
now you need to change this file adding the following
192.168.42.128 ulises-machine.localdomain ulises-machine
of course that you have to put your own hostname and IP address.
The next and final step is to reboot the networking services
Start your server again and try to connect to it using your client and it should work fine.
I hope this helps
SCJP 5.0, SCWCD 5.0, SCBCD 5.0, SCJD, SCEA in progress
Joined: Jul 24, 2008
Jun 27, 2009 22:44:59
whoops I forgot to mention
If you have an already set value in /etc/hosts with your server hostname comment it using # usually it has something like:
127.0.0.1 machine.localdomain machine
just comment this and add what I said in the previous post.
It is sorta covered in the
JavaRanch Style Guide
subject: java.net.ConnectionException Connection refused to: hostname problem with Linux and Windows solution
How to configure jBoss(5.x or above) to accept incoming requests through another machine?
Facing problem while accessing tomcat on a dedicated hosting Linux server
Waiting for Tomcat to shut down
ServerSocket IP address?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014