wood burning stoves 2.0*
The moose likes Distributed Java and the fly likes RMI problem with Localhost Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI problem with Localhost" Watch "RMI problem with Localhost" New topic
Author

RMI problem with Localhost

J You
Greenhorn

Joined: Jul 31, 2001
Posts: 29
Hi,I am testing an RMI application with my home
computer.This application is the Calculator example
from tutorial at Sun Java site.In the server program,
the code is like following
Calculator c = new CalculatorImpl();
Naming.rebind("rmi://localhost:1099/CalculatorService", c);
But when I run the client program,it got the
ConnectException:
java.rmi.ConnectException: connect refused to host: 152.163.0.0;Nested Exception is
java.net.ConnectException: Operation Timed out : connection
I think the problem is the TCP/IP configuration of
my home computer.This is a brand new computer and
I use dial connection to access Internet.It seems
in the RMI,it resolves the localhost to "152.163.0.0"(the ISP ip address?),which then
refues the connection.
If I ping localhost,I can get 127.0.0.1
when I ping the computer name,I get the 152.163.0.0
I also installed the Tomcat in the computer,and I
can access http://localhost:8080 (but the shutdown.bat fails,and I guess the reason is also
the localhost stuff)
following is the output of "ipconfig -all" command:
Windows IP Configuration
Host Name . . . . . . . . . . . . : MAYOU
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : WAN Network Driver
Physical Address. . . . . . . . . : 00-03-8A-00-00-11
Dhcp Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 152.163.0.0
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . :
PPP adapter Prodigy (San Antonio):
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : WAN (PPP/SLIP) Interface
Physical Address. . . . . . . . . : 00-53-45-00-00-00
Dhcp Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 66.140.232.3
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . : 66.140.232.3
DNS Servers . . . . . . . . . . . : 198.83.19.241 198.83.19.244
Also,I checked the file /Windows/System32/etc/hosts and it does have
127.0.0.1 localhost
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

The easiest workaround is to substitute 'localhost' with '127.0.0.1' -- should work just fine then.
That is, by the way, an ugly IP address you're being given. It's a network number (i.e., the address that identifies the network itself, not any one station) but if it's working then your ISP may be doing some hinky routing thing.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
arun sahni
Ranch Hand

Joined: Jan 16, 2002
Posts: 91
J YOU
You are using dialup connection to acceess to internet. That's why you PPP adapter in ipconfig.
You can assign ip address to your ethernet card starting with 10.10.10.x like 10.10.10.1 these are addresses assigned for intranet working and will not create clash outside world. Once you assign address then you can assign name in your host file like :
10.10.10.1 your_host_name
Then you can accesshttp://your_host_name ort# from your browser or any other protocol. Do not forget to change netmask to 255.255.255.0 otherwise you will not get host#.
[ March 27, 2002: Message edited by: arun sahni ]

Arun Sahni<br />SCJP2,SWCD,<br />BEA Certified Specialist: Server <br />JCert Enterprise Developer for BEA.
J You
Greenhorn

Joined: Jul 31, 2001
Posts: 29
Thanks,
After I assigned the 10.10.10.1 as the IP address
in the TCP/IP protocol property,all problems
disappeared.
I noticed the IP address was specified to
152.163.0.0.Still don't understand who originally set the static IP address,
the Computer manufactur,WinXP or the Dialup ISP?
Anyway,I am just very glad that the problems get
solved.
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
Hi I am also faced with the similar kind of problem.

Any solutions ??
Thanks
Ravi


SCJP, SCJD, SCWCD, SCBCD, SCEA
Terry Martinson
Ranch Hand

Joined: Oct 18, 2003
Posts: 293
I had the same problem, and after I assigned the IP address on my machine to 10.10.10.1 (just like J You above), it works fine for me too.
Thanks.
TJ


SCJP, SCJD, SCWCD, SCBCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI problem with Localhost
 
Similar Threads
NetworkInterface.isUp() is returning false for the interface which is up
Problems with Java RMI when having multiple IPs (private IP and public IP)
How to know programmatically whether a machne is in Global/Private network ?
Apache not working when connected to Wireless LAN