手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

net.sf.ehcache.CacheException异常解决方法

时间:2024-10-14 00:44:13

java.lang.C盟敢势袂lassNotFoundException: net.sf.ehcache.CacheExcepti泠贾高框on异常是hibernate初学者经常越到的问题,主要是包不正确引起的,缺少的是ehcache.jar包,作用是高速缓存!下边详细介绍一下

net.sf.ehcache.CacheException异常解决方法

工具/原料

hibernate初学者+myeclipse

java.lang.ClassNotFoundException: net.sf

1、Exception in thread "main" java.lang.NoClassDefFoundError: n髫潋啜缅et/sf/ehcache/CacheException at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at java.lang.Class.getConstructor0(Class.java:2699) at java.lang.Class.newInstance0(Class.java:326) at java.lang.Class.newInstance(Class.java:308) at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:327) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:219) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174) at com.softeem.test.Demo.main(Demo.java:22)Caused by: java.lang.ClassNotFoundException: net.sf.ehcache.CacheException at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 10 more异常错误截图

net.sf.ehcache.CacheException异常解决方法

2、出现此情况只需要添加一个jar包即可解决,百度搜索“ehcache.jar”下载

net.sf.ehcache.CacheException异常解决方法

3、下载后倒入工程,这里小编倒入的是user Library里边

net.sf.ehcache.CacheException异常解决方法
net.sf.ehcache.CacheException异常解决方法

4、倒入后重新运行,成功解决Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException

net.sf.ehcache.CacheException异常解决方法
net.sf.ehcache.CacheException异常解决方法
© 手抄报圈