ClassNotFoundException: edu.emory.mathcs.backport.java.util.concurrent.AbstractExecutorService异常解决

测试环境:

eclipse4.4

hibernate3

MySQL5


今天测试hibernate的查询缓存时出现以下异常:

java.lang.ExceptionInInitializerError
	at com.hibernate.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:17)
	at com.hibernate.util.HibernateUtil.<clinit>(HibernateUtil.java:7)
	at com.hibernate.test.QueryCacheTest.<init>(QueryCacheTest.java:18)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:195)
	at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:244)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:241)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.NoClassDefFoundError: edu/emory/mathcs/backport/java/util/concurrent/AbstractExecutorService
	at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:418)
	at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:334)
	at net.sf.ehcache.CacheManager.configure(CacheManager.java:306)
	at net.sf.ehcache.CacheManager.init(CacheManager.java:226)
	at net.sf.ehcache.CacheManager.<init>(CacheManager.java:213)
	at org.hibernate.cache.EhCacheProvider.start(EhCacheProvider.java:131)
	at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.start(RegionFactoryCacheProviderBridge.java:72)
	at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:238)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)
	at com.hibernate.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:12)
	... 24 more
<span style="color:#ff0000;">Caused by: java.lang.ClassNotFoundException: edu.emory.mathcs.backport.java.util.concurrent.AbstractExecutorService</span>
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	... 34 more


前提:二级缓存已开启

导致的原因是没有导入 backport-util-concurrent.jar这个包,导入就行了。


特此备份

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值