I am testing our server-application (written Java) on different operating systems and thought that OpenSolaris (2008.11) would be the least troublesome due to the nice Java integration. Turns out I was wrong, as I end up with a UnknownHostException
try {
computerName = InetAddress.getLocalHost().getHostName();
if (computerName.indexOf(".") > -1)
computerName = computerName.substring(0,
computerName.indexOf(".")).toUpperCase();
} catch (UnknownHostException e) {
e.printStackTrace();
}
The output is:
java.net.UnknownHostException: desvearth01: desvearth01
at java.net.InetAddress.getLocalHost(InetAddress.java:1353)
However, nslookup desvearth01
returns the correct IP address, and nslookup localhost
returns 127.0.0.1
as expected. Also, the same code works perfectly on FreeBSD. Is there anything special to OpenSolaris that I am not aware of?
Any hints appreciated, thanks.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…