Sunday 9 January 2011

Tomcat java.net.UnknownHostException Error

java.net.UnknownHostException: localhost: localhost
 at java.net.InetAddress.getAllByName0(InetAddress.java:1145)
 at java.net.InetAddress.getAllByName(InetAddress.java:1072)
 at java.net.InetAddress.getAllByName(InetAddress.java:1008)
 at java.net.InetAddress.getByName(InetAddress.java:958)
 at org.apache.catalina.core.StandardServer.await(StandardServer.java:373)
 at org.apache.catalina.startup.Catalina.await(Catalina.java:662)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:614)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:592)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

When tomcat shows up the error, the host file should be changed.

127.0.0.1 localhost

The host file is in C:\Windows\System32\drivers\etc

the file name is host

Please check this file.

This is only for windows OS.

No comments: