首页 > 代码库 > linux系统下部署TOMCAT异常:java.net.UnknownHostException
linux系统下部署TOMCAT异常:java.net.UnknownHostException
原文出自:http://www.myexception.cn/operating-system/444024.html
linux系统下部署TOMCAT错误:java.net.UnknownHostException
今天在修改linux环境中 /etc/hosts文件时候,保存之后,访问页面的时候突然这个错,后来网上查了下,解决了
java.net.UnknownHostException: vps**: vps**
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@vps** ~]# vi /etc/hosts
将看到如下代码:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
将以上代码修改成 也就是加个bogon
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 vps** localhost
然后按ESC 冒号 wq 保存后退出 reboot 重启后生效。
问道解决。以上异常就不会出现了。一切OK了。