JFinal配置EhCachePlugin后启动时报错:

发布于 2021-11-29 02:34:12 字数 9927 浏览 714 评论 3

配置方式:

public void configPlugin(Plugins me) {
        ...     
        //EhCache缓存
		me.add(new EhCachePlugin());

	}



引入了ehcache-core-2.6.10.jar以及slf4j相关日志包,更换过2.7.x&2.9.x的ehcache包都不行。

错误异常的堆栈输出信息如下:

2015-04-14 13:40:54
[ERROR]-[Thread: main]-[com.jfinal.core.Config.startPlugins()]: Plugin start error: com.jfinal.plugin.ehcache.EhCachePlugin. 
java.util.ServiceConfigurationError: net.sf.ehcache.EhcacheInit: Provider net.sf.ehcache.EhcacheCoreInit not a subtype
net.sf.ehcache.CacheException: java.util.ServiceConfigurationError: net.sf.ehcache.EhcacheInit: Provider net.sf.ehcache.EhcacheCoreInit not a subtype
	at net.sf.ehcache.LibraryInit.init(LibraryInit.java:55)
	at net.sf.ehcache.CacheManager.init(CacheManager.java:366)
	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:87)
	at com.jfinal.core.Config.configJFinal(Config.java:48)
	at com.jfinal.core.JFinal.init(JFinal.java:67)
	at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
	at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
	at org.eclipse.jetty.server.Server.doStart(Server.java:277)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at com.jfinal.server.JettyServer.doStart(JettyServer.java:120)
	at com.jfinal.server.JettyServer.start(JettyServer.java:64)
	at com.jfinal.core.JFinal.start(JFinal.java:159)
	at me.rocs.demo.core.ApplicationConfig.main(ApplicationConfig.java:195)
Caused by: java.util.ServiceConfigurationError: net.sf.ehcache.EhcacheInit: Provider net.sf.ehcache.EhcacheCoreInit not a subtype
	at java.util.ServiceLoader.fail(ServiceLoader.java:239)
	at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
	at net.sf.ehcache.LibraryInit.initService(LibraryInit.java:67)
	at net.sf.ehcache.LibraryInit.init(LibraryInit.java:50)
	... 26 more
四月 14, 2015 1:40:54 下午 org.eclipse.jetty.util.component.AbstractLifeCycle setFailed
警告: FAILED ConfigFilter: java.lang.RuntimeException: Plugin start error: com.jfinal.plugin.ehcache.EhCachePlugin. 
java.util.ServiceConfigurationError: net.sf.ehcache.EhcacheInit: Provider net.sf.ehcache.EhcacheCoreInit not a subtype
java.lang.RuntimeException: Plugin start error: com.jfinal.plugin.ehcache.EhCachePlugin. 
java.util.ServiceConfigurationError: net.sf.ehcache.EhcacheInit: Provider net.sf.ehcache.EhcacheCoreInit not a subtype
	at com.jfinal.core.Config.startPlugins(Config.java:96)
	at com.jfinal.core.Config.configJFinal(Config.java:48)
	at com.jfinal.core.JFinal.init(JFinal.java:67)
	at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
	at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
	at org.eclipse.jetty.server.Server.doStart(Server.java:277)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at com.jfinal.server.JettyServer.doStart(JettyServer.java:120)
	at com.jfinal.server.JettyServer.start(JettyServer.java:64)
	at com.jfinal.core.JFinal.start(JFinal.java:159)
	at me.rocs.demo.core.ApplicationConfig.main(ApplicationConfig.java:195)
Caused by: net.sf.ehcache.CacheException: java.util.ServiceConfigurationError: net.sf.ehcache.EhcacheInit: Provider net.sf.ehcache.EhcacheCoreInit not a subtype
	at net.sf.ehcache.LibraryInit.init(LibraryInit.java:55)
	at net.sf.ehcache.CacheManager.init(CacheManager.java:366)
	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:87)
	... 18 more
Caused by: java.util.ServiceConfigurationError: net.sf.ehcache.EhcacheInit: Provider net.sf.ehcache.EhcacheCoreInit not a subtype
	at java.util.ServiceLoader.fail(ServiceLoader.java:239)
	at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
	at net.sf.ehcache.LibraryInit.initService(LibraryInit.java:67)
	at net.sf.ehcache.LibraryInit.init(LibraryInit.java:50)
	... 26 more

四月 14, 2015 1:40:54 下午 org.eclipse.jetty.webapp.WebAppContext doStart
警告: Failed startup of context o.e.j.w.WebAppContext{/,file:/D:/Peng/_repo/src/_2015/jb2_demo/WebRoot/}
java.lang.RuntimeException: Plugin start error: com.jfinal.plugin.ehcache.EhCachePlugin. 
java.util.ServiceConfigurationError: net.sf.ehcache.EhcacheInit: Provider net.sf.ehcache.EhcacheCoreInit not a subtype
	at com.jfinal.core.Config.startPlugins(Config.java:96)
	at com.jfinal.core.Config.configJFinal(Config.java:48)
	at com.jfinal.core.JFinal.init(JFinal.java:67)
	at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
	at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
	at org.eclipse.jetty.server.Server.doStart(Server.java:277)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at com.jfinal.server.JettyServer.doStart(JettyServer.java:120)
	at com.jfinal.server.JettyServer.start(JettyServer.java:64)
	at com.jfinal.core.JFinal.start(JFinal.java:159)
	at me.rocs.demo.core.ApplicationConfig.main(ApplicationConfig.java:195)
Caused by: net.sf.ehcache.CacheException: java.util.ServiceConfigurationError: net.sf.ehcache.EhcacheInit: Provider net.sf.ehcache.EhcacheCoreInit not a subtype
	at net.sf.ehcache.LibraryInit.init(LibraryInit.java:55)
	at net.sf.ehcache.CacheManager.init(CacheManager.java:366)
	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:87)
	... 18 more
Caused by: java.util.ServiceConfigurationError: net.sf.ehcache.EhcacheInit: Provider net.sf.ehcache.EhcacheCoreInit not a subtype
	at java.util.ServiceLoader.fail(ServiceLoader.java:239)
	at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
	at net.sf.ehcache.LibraryInit.initService(LibraryInit.java:67)
	at net.sf.ehcache.LibraryInit.init(LibraryInit.java:50)
	... 26 more

四月 14, 2015 1:40:55 下午 org.eclipse.jetty.server.AbstractConnector doStart
信息: Started SelectChannelConnector@0.0.0.0:8080
Starting Complete. Welcome To The JFinal World :)




如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

把昨日还给我 2021-11-29 14:31:09

提示 NoSuchMethodException,应该是 ehcache 版本不对,仔细看一下项目引用的所有 jar 包的引用关系,如果有多次引用,老版本可能被生效

别再吹冷风 2021-11-29 09:14:05

引用来自“JFinal”的评论

jfinal 官方网站有一个  jfinal-1.9-all.zip 供下载,里面提供了 ehcache 的所需要的 jar 包,试一下这个应该可以,都是经过严格测试的

奈何桥上唱咆哮 2021-11-29 06:28:41

jfinal 官方网站有一个  jfinal-1.9-all.zip 供下载,里面提供了 ehcache 的所需要的 jar 包,试一下这个应该可以,都是经过严格测试的

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文