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

时间:2026-02-14 04:30:09

1、Exception in thread "main" java.lang.NoClassDefFoundError: net/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异常解决方法

© 2026 一点知道
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com