JFinal ehcache 获取主机名失败

项目在启动时提示错误,同样的服务器  spring框架下使用ehcache就没有报这个错误

at java.net.InetAddress.getLocalHost(InetAddress.java:1473)

at net.sf.ehcache.Cache.<clinit>(Cache.java:214)

at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:296)

at net.sf.ehcache.config.ConfigurationHelper.createCaches(ConfigurationHelper.java:234)

at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:755)

at net.sf.ehcache.CacheManager.doInit(CacheManager.java:459)

at net.sf.ehcache.CacheManager.init(CacheManager.java:377)

at net.sf.ehcache.CacheManager.<init>(CacheManager.java:259)

at net.sf.ehcache.CacheManager.newInstance(CacheManager.java:1037)

at net.sf.ehcache.CacheManager.newInstance(CacheManager.java:818)

at net.sf.ehcache.CacheManager.create(CacheManager.java:799)

at com.jfinal.plugin.ehcache.EhCachePlugin.createCacheManager(EhCachePlugin.java:90)

at com.jfinal.plugin.ehcache.EhCachePlugin.start(EhCachePlugin.java:61)

at com.jfinal.core.Config.startPlugins(Config.java:107)

at com.jfinal.core.Config.configJFinal(Config.java:51)

at com.jfinal.core.JFinal.init(JFinal.java:63)

at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)


评论区

JFinal

2017-12-28 14:49

异常 cause 部分内容没有,没法推断问题原因

Jfinal1234

2017-12-28 14:55

@JFinal [ERROR]-[Thread: ajp-bio-8009-exec-9]-[net.sf.ehcache.Cache.()]: Unable to set localhost. This prevents creation of a GUID. Cause was: XXX: XXX: 未知的名称或服务
java.net.UnknownHostException: XXX: XXX: 未知的名称或服务
at java.net.InetAddress.getLocalHost(InetAddress.java:1473)
at net.sf.ehcache.Cache.(Cache.java:214)
at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:296)
at net.sf.ehcache.config.ConfigurationHelper.createCaches(ConfigurationHelper.java:234)
at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:755)
at net.sf.ehcache.CacheManager.doInit(CacheManager.java:459)
at net.sf.ehcache.CacheManager.init(CacheManager.java:377)
at net.sf.ehcache.CacheManager.(CacheManager.java:259)
at net.sf.ehcache.CacheManager.newInstance(CacheManager.java:1037)
at net.sf.ehcache.CacheManager.newInstance(CacheManager.java:818)
at net.sf.ehcache.CacheManager.create(CacheManager.java:799)
at com.jfinal.plugin.ehcache.EhCachePlugin.createCacheManager(EhCachePlugin.java:90)
at com.jfinal.plugin.ehcache.EhCachePlugin.start(EhCachePlugin.java:61)
at com.jfinal.core.Config.startPlugins(Config.java:107)
at com.jfinal.core.Config.configJFinal(Config.java:51)
at com.jfinal.core.JFinal.init(JFinal.java:63)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1256)
at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:692)
at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:217)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:213)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:610)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:193)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.net.UnknownHostException: XXX: 未知的名称或服务
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
at java.net.InetAddress.getLocalHost(InetAddress.java:1469)
... 52 more
主机名确实在hosts中未设置 但我的问题是为什么spring没有报错 而jfinal会

JFinal

2017-12-28 15:05

UnknownHostException 域名错误,或者域名没法解析而已,很好解决

JFinal

2017-12-28 15:05

ehcache 内部的问题 jfinal 是不会干预的, 就是想干预也干预不到。 你说的 spring 下可以使用,可以确定的说是有不同因素在起作用,例如运行环境等等因素

Jfinal1234

2017-12-28 15:10

@JFinal 我在用一个服务器上运行的,配置是相同的

JFinal

2017-12-28 15:24

@Jfinal1234
http://bjyzxxds.iteye.com/blog/2155347
http://blog.csdn.net/zhufuing/article/details/8146667
https://www.cnblogs.com/rockdean/articles/2439030.html
http://blog.csdn.net/zhufuing/article/details/8146667

这个问题决然与 jfinal 无关

热门反馈

扫码入社