"M. Suresh Babu" wrote:
>
> Hello everyone,
>
> Im just switched over to 1.2 in linux (nice work!). Im facing one
> problem. i dunno if it is a bug or correction in new release.
>
> Using 1.1.7, the static method 'InetAddress.getLocalHost()' returns
> the local machine address.
>
> But the same in 1.2 returns some other differenet address. (
> 'localhost/127.0.0.1' . This is given in /etc/hosts for loopbacking!).
>
> try {
> System.out.println( "Local Host : " +
> InetAddress.getLocalHost() );
> }
> catch( UnknownHostException exe) {}
>
> this, prints msbabu/x.x.x.x (where x.x.x.x is my machine's IP
> address) with 1.1.7
>
> and prints localhost/y.y.y.y in 1.2
>
> Anybody knows why this occurs?.
I found an anonmaly related to this, and if you check your /etc/hosts
you probably have the localhost as the first entry, for some strange
reason, it appears that Java 2 assumes that the first entry is the
hostname of the machine, and then resolves this, and gets the corresponding
ip address.
I don't know if it will return an unrelated name, if it was first (I
only have two entries in the /etc/hosts, localhost, and my machine
name, but if localhost is first, Java 2 thinks that this is the hostname,
and this causes problems with CORBA.
Put your machine name first, and the problem goes away. (I know it is a
hack, but I have mailed this problem description before).
mvh
mike.
--
#include <stddisclaimer.h>
-----------------------------------------------------------------------
(Ingeniør) Michael Nielsen BE(Hons)
work email : [EMAIL PROTECTED] telf: +45 9828 4611 x 26
Private email : [EMAIL PROTECTED] fax : +45 9828 4565
-----------------------------------------------------------------------
At arbejede er godt, så længe man husker at leve!
(To work is good as long as we remember to live!)
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]