1

dedicated Linux server throws UnknownHostException.

InetAddress addr;
    try {
        addr = InetAddress.getLocalHost();
    } catch (UnknownHostException e) {
        throw new InstantiationError("cannot find hub ip");
    }
KJW
  • 14,705
  • 45
  • 133
  • 241
  • Have you had a look at these http://www.google.co.uk/search?q=getLocalHost+UnknownHostException as I believe the are multiple possible causes. – Peter Lawrey Jun 09 '11 at 15:20

2 Answers2

3

you might not have mapping of localhost in your system32\drivers\etc\hosts (win) /etc/hosts (linux)

jmj
  • 232,312
  • 42
  • 391
  • 431
0

Another option I found was this(which I like as I don't have to repeat the hostname in both files now)...

java getLocalHost() UnknownHostException /etc/hosts file differs linux api?

Community
  • 1
  • 1
Dean Hiller
  • 18,155
  • 21
  • 116
  • 187