linux系统下部署TOMCAT错误:java.net.UnknownHostException: bogon: bogon
java.net.UnknownHostException: bogon: bogon
at java.net.InetAddress.getLocalHost(InetAddress.java:1353)
at org.apache.jk.common.ChannelSocket.unLockSocket(ChannelSocket.java:490)
at org.apache.jk.common.ChannelSocket.pause(ChannelSocket.java:289)
at org.apache.jk.server.JkMain.pause(JkMain.java:681)
at org.apache.jk.server.JkCoyoteHandler.pause(JkCoyoteHandler.java:163)
at org.apache.catalina.connector.Connector.pause(Connector.java:1032)
at org.apache.catalina.core.StandardService.stop(StandardService.java:489)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:734)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:602)
at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.java:645)
解决这个异常的方法是
主机映射的原因。
修改etc/hosts文件
用root用户登陆后
[root@bogon ~]# vi /etc/hosts
将看到如下代码:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
将以上代码修改成也就是加个bogon
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 bogon localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
然后按ESC 冒号 wq 保存后退出 reboot 重启后生效。
问道解决。以上异常就不会出现了。一切OK了。