NutzCN Logo
问答 加入缓存jar,控制台提示未找到
发布于 2758天前 作者 gitwqj 2038 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk
java.lang.NoClassDefFoundError: net/sf/ehcache/CacheManager
	at cn.xhbds.MainSetup.init(MainSetup.java:39)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:277)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	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.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4572)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5215)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1404)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1394)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: net.sf.ehcache.CacheManager
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
	... 18 more

这是pom

net.sf.ehcache
ehcache
2.10.2.2.21
true

这是mainsetup
import net.sf.ehcache.CacheManager;
CacheManager cacheManager = ioc.get(CacheManager.class);
log.debug("Ehcache CacheManager = " + cacheManager);
在lib里面已经存在jar包了

6 回复

重新发pom, "发帖/回复"旁边有个按钮!!

<dependency>
			<groupId>net.sf.ehcache</groupId>
			<artifactId>ehcache</artifactId>
			<version>2.10.2.2.21</version>
			<optional>true</optional>
		</dependency>

optional去掉

这表示已经启动成功了吧,感谢兽总

2017-04-28 11:13:06,896 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'cacheManager'<class net.sf.ehcache.CacheManager>
2017-04-28 11:13:06,896 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - 	 >> Load definition name=cacheManager
2017-04-28 11:13:06,896 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=cacheManager
2017-04-28 11:13:06,896 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(cacheManager) in JsonLoader(paths=[config/ioc/, config/custom])
2017-04-28 11:13:06,896 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - 	 >> Make...'cacheManager'<class net.sf.ehcache.CacheManager>
2017-04-28 11:13:06,918 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class net.sf.ehcache.CacheManager without AOP
2017-04-28 11:13:06,918 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'cacheManager' to [app] 
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2017-04-28 11:13:07,133 cn.xhbds.MainSetup.init(MainSetup.java:40) DEBUG - Ehcache CacheManager = __DEFAULT__

缺slf4j-log4j12,否则日志不全的

好的,感谢兽总

添加回复
请先登陆
回到顶部