java.net.UnknownHostException: xxx: 未知的名称或服务

来源:互联网 发布:激战2女夏尔捏脸数据 编辑:程序博客网 时间:2024/06/04 19:56

注:xxx:代表服务器名称

报错代码:

[ERROR]-[Thread: localhost-startStop-1]-[net.sf.ehcache.Cache.<clinit>()]: Unable to set localhost. This prevents creation of a GUID. Cause was: xxx: 未知的名称或服务java.net.UnknownHostException: xxx: 未知的名称或服务at java.net.InetAddress.getLocalHost(InetAddress.java:1475)............Caused by: java.net.UnknownHostException: xxx: 未知的名称或服务at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1295)at java.net.InetAddress.getLocalHost(InetAddress.java:1471)... 32 more

解决方案:

修改hosts文件  映射host名到127.0.0.1

vim /etc/hosts
127.0.0.1   xxx localhost 
1 0
原创粉丝点击