Version 2

    Why is it trying to use localhost

     

    It is common on some linux distributions for it to map your hostname to localhost/127.0.0.1 this confuses java.

     

    /etc/hosts (wrong)

    127.0.0.1 myhost localhost.localdomain localhost
    

    /etc/hosts (correct)

    ipaddress myhost
    127.0.0.1 localhost.localdomain localhost
    

     

    Check what java thinks is your host/ip

    import java.net.InetAddress;
    
    public class WhatIsMyAddress
    {
       public static void main(String[] args) throws Exception
       {
          System.out.println(InetAddress.getLocalHost());
       }
    }