Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Once again, thanks to the guidance of the people here, I've found an answer. The Java program above works when I do the following:</p> <pre><code>java -Djava.net.preferIPv4Stack=true DomainResolutionTest </code></pre> <hr> <p>Details:</p> <pre><code>jgreenwood@jeg-ubuntu64:~$ java -Djava.net.preferIPv4Stack=true DomainResolutionTest www.google.com/209.85.225.106 jgreenwood@jeg-ubuntu64:~$ java DomainResolutionTest ERROR: www.google.com java.net.UnknownHostException: www.google.com at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:849) at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1200) at java.net.InetAddress.getAllByName0(InetAddress.java:1153) at java.net.InetAddress.getAllByName(InetAddress.java:1083) at java.net.InetAddress.getAllByName(InetAddress.java:1019) at java.net.InetAddress.getByName(InetAddress.java:969) at DomainResolutionTest.main(DomainResolutionTest.java:12) </code></pre> <p>It turns out that there is a bug in the IPv6 stack. There are a couple of posts that led me to this conclusion:</p> <p><a href="http://uclue.com/?xq=2127" rel="nofollow noreferrer">http://uclue.com/?xq=2127</a></p> <p><a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477211" rel="nofollow noreferrer">http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477211</a></p> <p><a href="https://answers.launchpad.net/ubuntu/+question/23024" rel="nofollow noreferrer">https://answers.launchpad.net/ubuntu/+question/23024</a></p> <p>I sure hope I don't have to add the IPv4 crap in every time I run a Java app. The final solution may be in the second link - a missing package. We shall see.</p> <blockquote> <p>Debian Bug report logs - #477211 ia32-sun-java6-bin: Needs to depend on lib32nss-mdns ... Cannot resolve domain names. Resolve fine on the rest of the system, have not tested with other JDK's. Installed from package and set with update-java-alternatives.</p> <p>DNS works for everything else on my system. Running on Debian 2.6.23-AMD64. Have tried both Lenny packages and Sid packages. Works as expected with sun-java6-bin, fails with ia32-sun-java6-bin. Arg. ... If you hit java with strace you'll see that it is trying to use libnss_mdns4_minimal.so.2, which is available in the package lib32nss-mdns. You should add a dependency on that to fix the bug.</p> <p>Same thing happens for sun-java6-bin - libnss-mdns is used here.</p> </blockquote> <p>The package is indeed missing on my machine:</p> <pre><code>jgreenwood@jeg-ubuntu64:~$ dpkg -L lib32nss-mdns Package `lib32nss-mdns' is not installed. Use dpkg --info (= dpkg-deb --info) to examine archive files, and dpkg --contents (= dpkg-deb --contents) to list their contents. </code></pre> <p>Either way, I hope this post helps someone else, because this was a major PITA to figure out.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload