ITeye博客

ehcache报告UnknownHostException错误

harbey · 2010-06-05 15:07 · Java · 编程语言 · Markdown

报错如下:


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配置有错误!!!我们应用中是这样引起的,也有可能是其他原因引起,要以实际情况为准!

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。