ehcache報告UnknownHostException錯誤

報錯如下:

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配置有錯誤!!!我們應用中是這樣引起的,也有可能是其他原因引起,要以實際情況爲準!
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章