开发者社区> 问答> 正文

JFinal配置EhCachePlugin后启动时报错:?报错

配置方式:

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 :)




展开
收起
爱吃鱼的程序员 2020-06-14 16:44:37 759 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

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

    引用来自“JFinal”的评论

    jfinal官方网站有一个 jfinal-1.9-all.zip供下载,里面提供了ehcache的所需要的jar包,试一下这个应该可以,都是经过严格测试的提示NoSuchMethodException,应该是ehcache版本不对,仔细看一下项目引用的所有jar包的引用关系,如果有多次引用,老版本可能被生效

    2020-06-14 16:44:53
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Java Spring Boot开发实战系列课程(第17讲):Spring Boot 2.0实战Docker容器Linux 立即下载
Java Spring Boot开发实战系列课程【第7讲】:Spring Boot 2.0安全机制与MVC身份验证实战(Java面试题) 立即下载
Java Spring Boot开发实战系列课程【第15讲】:Spring Boot 2.0 API与Spring REST Docs实战 立即下载