JDK-4060691 : java.net.InetAddress.getLocalHost() returns 127.0.0.1
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 1.1.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1
  • CPU: sparc
  • Submitted: 1997-06-23
  • Updated: 1997-08-29
  • Resolved: 1997-08-29
Related Reports
Duplicate :  
Description

Name: sgC58550			Date: 06/23/97


java.net.InetAddress.getLocalHost() returns 127.0.0.1

Platform: Solaris 2.4 on a Sparc station
When I run the following code:

   java.net.InetAddress oLocalHost = java.net.InetAddress.getLocalHost();
   System.out.println("ReportTestServer.bindServers() - local host name: ");
   System.out.println(oLocalHost.getHostName());

   System.out.println("ReportTestServer.bindServers() - local host address: ");
   System.out.println(oLocalHost.getHostAddress());

I get the following output on the Solaris box:

ReportTestServer.bindServers() - local host name:
localhost
ReportTestServer.bindServers() - local host address:
127.0.0.1

When I run on a WIN95 box, I get the correct local host, e.g.,:

ReportTestServer.bindServers() - local host name:
spider
ReportTestServer.bindServers() - local host address:
129.9.200.103

/etc/hosts is set up as usual with localhost set to 127.0.0.1
and the particluar node set up properly.  Both hostname and uname -n
return the proper name/address for the node.

I do belive this is also the cause of the problems with bind/rebind/unbind
in RMI (as documented in other bugs).  It also causes Visigenic's
CORBA implementation the same problems.  In general this is preventing
me from running servers on a Solaris box and clients on other
boxes using RMI and/or CORBA.
company - Marinbridge Corporation Ltd. , email - ###@###.###
======================================================================

Comments
WORK AROUND Name: sgC58550 Date: 06/23/97 I cannot find one except for butchering the /etc/hosts file which I am not about to do. ======================================================================
11-06-2004

EVALUATION Closed as a dup. benjamin.renaud@Eng 1997-08-29
29-08-1997