1

dedicated Linux server throws UnknownHostException.

InetAddress addr;
    try {
        addr = InetAddress.getLocalHost();
    } catch (UnknownHostException e) {
        throw new InstantiationError("cannot find hub ip");
    }
KJW
  • 15,035
  • 47
  • 137
  • 243
  • 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
  • 237,923
  • 42
  • 401
  • 438
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
  • 19,235
  • 25
  • 129
  • 212