Hi again,

I just came across a huge clue.  A friend had me look again at the java.net
properties.  This one makes the test program work:
        -Djava.net.preferIPv4Stack=true

Now, as to why suddenly Java was preferring the IPv6 stack, I have no idea.

On  2.11.10, Steve White wrote:
> Hi,
> 
> A Java networking problem has arisen very recently on one of our servers,
> an Opeteron with Scientific Linux 5.5, running the distro Java without
> problems--until a week or so ago.
>  
> The effect is that all Java apps have become unable to do DNS host name
> resolution, and throw an UnknownHostException.  However nothing seems
> otherwise amiss with networking on this machine.  All non-Java programs
> resolve outside host names fine.
> 
> I wrote a small test program, attached.  It works fine on other machines
> here.  Fails on the server, with an IP address.  But if I give it a valid
> IP number, or the name of the server itself, it succeeds.
> 
> I have done security updates fairly regularly; this may have something to
> do with the problem, but I really don't know for sure.
> 
> Also tried:
> 
> * Cut the hosts file down to the bare minimum, and also the resolv.conf
>   file and re-started networking.  No improvement.
> 
> * Logged in as various users.  All show the same problem.
> 
> * Cut down and exported all related environment variables to bare minimum
>       (JAVA_HOME, PATH, *LIBRARY_PATH, etc),
>   No effect.
> 
> * Reversed the updates from last week, and re-booted with the
>   previous kernel.  No improvement.
> 
> * Fiddled with various Java system properties, as in
>   
> http://download.oracle.com/javase/6/docs/technotes/guides/net/properties.html
>   Nothing seemed to help.
> 
> * Installed a Java 1.5, built the test program with it, ran the test program
>   under that.  It failed just like the distro version.
> 
> Any ideas?
> 
> =========================================================
> To run the attached test
>       javac nettest.java
>       java nettest <hostname> <optional-port-number>
> 
> -- 
> | -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
> | Steve White                                             +49(331)7499-202
> | E-Science                                        Zi. 27  Villa Turbulenz 
> | -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
> | Astrophysikalisches Institut Potsdam (AIP)
> | An der Sternwarte 16, D-14482 Potsdam
> |
> | Vorstand: Prof. Dr. Matthias Steinmetz, Peter A. Stolz
> |
> | Stiftung privaten Rechts, Stiftungsverzeichnis Brandenburg: III/7-71-026
> | -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

> import java.net.Socket;
> 
> public class
> nettest
> {
>       public static void
>       main( String [] a )
>       {
>               if( a.length > 0 )
>               {
>                       String host = a[0];
>                       int    port = 80;
>                       if( a.length > 1 )
>                       {
>                               port = Integer.parseInt( a[1] );
>                       }
>                       try
>                       {
>                               Socket si = new Socket( host, port );
>                               System.out.println( "Success connecting to "
>                                       + host );
>                       }
>                       catch( Exception e )
>                       {
>                               System.err.println( e.toString() );
>                               e.printStackTrace();
>                       }
>               }
>               else
>               {
>                       System.err.println( "please provide host string" );
>               }
>       }
> }


-- 
| -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
| Steve White                                             +49(331)7499-202
| E-Science                                        Zi. 27  Villa Turbulenz 
| -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
| Astrophysikalisches Institut Potsdam (AIP)
| An der Sternwarte 16, D-14482 Potsdam
|
| Vorstand: Prof. Dr. Matthias Steinmetz, Peter A. Stolz
|
| Stiftung privaten Rechts, Stiftungsverzeichnis Brandenburg: III/7-71-026
| -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

Reply via email to