java.lang.IllegalAccessError

java.lang.IllegalAccessError

在测试hibernate是,当程序运行到如下的语句时:

 Configuration configuration  =   new  Configuration();
出现了如下的错误,
 1 java.lang.IllegalAccessError: tried  to  access method net.sf.ehcache.CacheManager. < init > ()V  from  class org.hibernate.cache.EhCacheProvider
 2     at org.hibernate.cache.EhCacheProvider.start(EhCacheProvider.java: 124 )
 3     at org.hibernate.impl.SessionFactoryImpl. < init > (SessionFactoryImpl.java: 180 )
 4     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java: 1213 )
 5     at no.brodwall.demo.domain.persist.ProductDAOTest.setUp(ProductDAOTest.java: 45 )
 6     at junit.framework.TestCase.runBare(TestCase.java: 125 )
 7     at junit.framework.TestResult$ 1 .protect(TestResult.java: 106 )
 8     at junit.framework.TestResult.runProtected(TestResult.java: 124 )
 9     at junit.framework.TestResult.run(TestResult.java: 109 )
10     at junit.framework.TestCase.run(TestCase.java: 118 )
11     at junit.framework.TestSuite.runTest(TestSuite.java: 208 )
12     at junit.framework.TestSuite.run(TestSuite.java: 203 )
13     at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java: 128 )
14     at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java: 38 )
15     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 460 )
16     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 673 )
17     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java: 386 )
18     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java: 196 )
在网上找呀找,终于找到了,是ehcache的一个bug引起的,把ehcache升级到1.2以上的版本就行了,:0)

你可能感兴趣的:(java.lang.IllegalAccessError)