kjkoster
09-04-2010, 04:49
Dear All,
This week one of our admins showed me something that stumped me completely. He had a Java webstart application that ran fine on a number of (UNIXy) machines, but that just would not run on his own laptop. OS version where the same and Java versions also.
When he ran the application, he got an error reading: "java.net.NoRouteToHostException: Network is unreachable" for the things that Java webstart tried to download from the code base.
Simple, right? Network configuration? Firewall? Interestingly. he could access the files on the code base URL just fine using wget or curl. That told us that basic network connectivity was fine.
Well, that's what we thought.
After some digging, we found that he was being bitten by the fact that Java does not deal gracefully with IPv6 sockets. Debian Linux and some BSD's make IPv6 the default now, so this is something that we may have to deal with more and more. I wrote about possible IPv6 issues before (http://java-monitor.com/forum/showthread.php?t=189). More information about this can be found on the Debian bug tracker (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560056) and on Sun's bug tracker (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561).
In essence: we thought that Java webstart was trying to access the code base using IPv4 addresses, which should work. Instead, Java was using the IPv6 stack, which did not work. The "Network is unreachable" message only makes sense if you realize that this is about the IPv6 network, not the IPv4 network.
To make diagnosing this even harder: nothing in the stack trace suggested IPv6 was being used. This blog post about Java and IPv6 on BSD systems (http://diario.beerensalat.info/2008/10/12/java_and_ipv6_on_bsd.html) explains why that is: the operating system defaults decide whether Java uses IPv4 or IPv6 or both.
I will be setting -Djava.net.preferIPv4Stack (http://java.sun.com/javase/6/docs/technotes/guides/net/ipv6_guide/index.html#ipv6-networking)=true in my server startup files from now on. Just to be sure.
Kees Jan
This week one of our admins showed me something that stumped me completely. He had a Java webstart application that ran fine on a number of (UNIXy) machines, but that just would not run on his own laptop. OS version where the same and Java versions also.
When he ran the application, he got an error reading: "java.net.NoRouteToHostException: Network is unreachable" for the things that Java webstart tried to download from the code base.
Simple, right? Network configuration? Firewall? Interestingly. he could access the files on the code base URL just fine using wget or curl. That told us that basic network connectivity was fine.
Well, that's what we thought.
After some digging, we found that he was being bitten by the fact that Java does not deal gracefully with IPv6 sockets. Debian Linux and some BSD's make IPv6 the default now, so this is something that we may have to deal with more and more. I wrote about possible IPv6 issues before (http://java-monitor.com/forum/showthread.php?t=189). More information about this can be found on the Debian bug tracker (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560056) and on Sun's bug tracker (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561).
In essence: we thought that Java webstart was trying to access the code base using IPv4 addresses, which should work. Instead, Java was using the IPv6 stack, which did not work. The "Network is unreachable" message only makes sense if you realize that this is about the IPv6 network, not the IPv4 network.
To make diagnosing this even harder: nothing in the stack trace suggested IPv6 was being used. This blog post about Java and IPv6 on BSD systems (http://diario.beerensalat.info/2008/10/12/java_and_ipv6_on_bsd.html) explains why that is: the operating system defaults decide whether Java uses IPv4 or IPv6 or both.
I will be setting -Djava.net.preferIPv4Stack (http://java.sun.com/javase/6/docs/technotes/guides/net/ipv6_guide/index.html#ipv6-networking)=true in my server startup files from now on. Just to be sure.
Kees Jan