`

ehcache报告UnknownHostException错误

    博客分类:
  • Java
阅读更多
报错如下:
java.net.UnknownHostException: 主机名: 主机名
        at java.net.InetAddress.getLocalHost(InetAddress.java:1353)
        at net.sf.ehcache.Cache.<clinit>(Cache.java:145)
        at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:452)
        at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:368)
        at net.sf.ehcache.CacheManager.configure(CacheManager.java:321)
        at net.sf.ehcache.CacheManager.init(CacheManager.java:237)
        at net.sf.ehcache.CacheManager.<init>(CacheManager.java:210)
        at org.springframework.cache.ehcache.EhCacheManagerFactoryBean.afterPropertiesSet(EhCacheManagerFactoryBean.java:113)
        at or

原因:
encache源码:
 static {
        try {
            localhost = InetAddress.getLocalHost();
        } catch (UnknownHostException e) {
            LOG.log(Level.SEVERE, "Unable to set localhost. This prevents creation of a GUID. Cause was: " + e.getMessage(), e);
        } catch (java.lang.NoClassDefFoundError e) {
            LOG.log(Level.FINE, "InetAddress is being blocked by your runtime environment. e.g. Google App Engine." +
                    " Ehcache will work as a local cache.");
        }
    }


解决办法:
有可能是本地机器配置的域名解析Host配置有错误!!!我们应用中是这样引起的,也有可能是其他原因引起,要以实际情况为准!
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics