How to Resolve java.net.unknownhostexception in Jboss
This post describes How to Resolve java.net.unknownhostexception in Jboss.
Many times we have seen when we start jboss we are facing one exception in jboss "java.net.UnknownHostException".
1: java.net.UnknownHostException: localhost.localdomain: localhost.localdomain
2: at java.net.InetAddress.getLocalHost(InetAddress.java:1234)
3: at org.jboss.system.server.ServerInfo.getHostAddress(ServerInfo.java:233)
How to resolve this Exception.One Quick solutions to resolve this exception is modify /etc/hosts configuration file in linux.
in this post will discuss how to modify /etc/hosts file and how to change entry in /etc/hosts file.
What is /etc/hosts file
The hosts file contains lines of text containing IP address in the first text field followed by one or more host names.
Each field is separated by white space (blanks or seperated by tab).
Comment lines may be included; they are indicated by a hash character (#) in the first position of such lines. Entirely blank lines in the file are ignored.
1: # IPAddress Hostname Alias
2: 192.168.11.55 chkmmd051.kgnglobal.local chkmmd051
3: 127.0.0.1 localhost.localdomain localdomain
4: ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
The left column is the IP address to be resolved. The next column is that host's name and next columns are alias for that host. In the second line, for example, the IP address 192.168.11.55 is for the host chkmmd051.kgnglobal.local Another alias is chkmmd051.
to change this file will require root user permission, After you are finished configuration of your files, don't forget to restart your services and restart your jboss server for the changes to take effect.References :
- How do I modify my hosts file? @ http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file
- How to Modify /etc/hosts @ http://community.linuxmint.com/tutorial/view/159