getHostName() broken?

Brad Karp bkarp+ at cs.cmu.edu
Thu Aug 19 20:02:10 PDT 2004


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 at cs.cmu.edu


More information about the freebsd-java mailing list