首页 > 编程语言 > 详细

centOS 之 java.net.UnknownHostException: centos: centos: 未知的名称或服务

时间:2019-10-22 15:39:55      阅读:193      评论:0      收藏:0      [点我收藏+]
  • 应用场景:启动javaWeb项目时,报错后终止。提示如下:

    Initializing EhCache CacheManager
    2019-10-21 22:36:20.486 ERROR 9783 --- [ main] net.sf.ehcache.Cache :
    Unable to set localhost. This prevents creation of a GUID. Cause was: centos: centos: 未知的名称或服务

      java.net.UnknownHostException: centos: centos: 未知的名称或服务
       at java.net.InetAddress.getLocalHost(InetAddress.java:1506) ~[na:1.8.0_231]
       at net.sf.ehcache.Cache.<clinit>(Cache.java:214) ~[ehcache-core-2.6.11.jar!/:na]
       at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:296) [ehcache-core-2.6.11.jar!/:na]
       at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:219) [ehcache-core-2.6.11.jar!/:na]
       at net.sf.ehcache.CacheManager.configure(CacheManager.java:722) [ehcache-core-2.6.11.jar!/:na]
  • 产生原因: 当前用户未同 127.0.0.1建立映射关系
  • 解决办法: 编辑hosts文件,将报错名称添加到127.0.0.1的映射中

      127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4  centos //此处添加centos
      ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

centOS 之 java.net.UnknownHostException: centos: centos: 未知的名称或服务

原文:https://www.cnblogs.com/guojuboke/p/11719935.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!