UnknownHostException in Java application when calling getLocalHost
Issue
Error looking up local address
caused byjava.net.UnknownHostException
at startup.-
Java fails when looking up a JMX server with error:
Error executing command: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ConfigurationException [Root exception is java.rmi.UnknownHostException: Unknown host: example; nested exception is: java.net.UnknownHostException: example]
-
Java's
java.net.InetAddress.getLocalHost
throws UnknownHostException when host's defined host name cannot be resolved.
Environment
- Java Virtual Machine
- Call to
getLocalHost
to retrieve private or local platform's host name
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.