Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Aug 2004 23:01:30 -0400
From:      Brad Karp <bkarp+@cs.cmu.edu>
To:        freebsd-java@freebsd.org
Subject:   getHostName() broken?
Message-ID:  <20040820030209.9E7D643D1D@mx1.FreeBSD.org>

next in thread | raw e-mail | index | archive | help
I'm running 4.9-RELEASE, and have built the jdk1.4.2 port using revision 5
of the FreeBSD patch kit.

I have a visualization application written in Java by a colleague that I've
been running. The application shows nodes in a large-scale distributed system,
and allows clicking on a host to show its Internet hostname.

The code uses getHostName() to do this.

I find that these reverse DNS lookups *all* fail; getHostName() returns a
String that is a textual representation of the IP address. (There's no
security manager involved here, BTW. The reference for getHostName() says
the security manager may check for authorization on getHostName() calls,
but I've not changed my Java runtime's security policy from the defaults.)

Further poking reveals that *no* outbound DNS queries (traffic destined for
UDP or TCP port 53) are being generated for these reverse name lookups!

I'm perplexed. Can it really be that InetAddress.getHostName() is broken on
FreeBSD? Has anyone seen similar behavior, and if so, can you propose a
workaround, apart from linking in C code to do these reverse name lookups?

Thanks,
-Brad, bkarp@cs.cmu.edu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040820030209.9E7D643D1D>