zoukankan      html  css  js  c++  java
  • centOS 之 java.net.UnknownHostException: centos: centos: 未知的名称或服务

    • 应用场景:启动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
  • 相关阅读:
    Ubuntu 查看网关地址方法
    cf451C-Predict Outcome of the Game
    C语言运算符优先级
    文件的概念以及VC里的一些文件操作API简介
    关于空指针NULL、野指针、通用指针
    由字符串常量引发的思考
    数字三角形问题
    cdoj第13th校赛初赛F
    cdoj第13th校赛初赛H
    cdoj第13th校赛初赛L
  • 原文地址:https://www.cnblogs.com/guojuboke/p/11719935.html
Copyright © 2011-2022 走看看