Hibernate version: 3.2.x (ehcache 1.2.3)
In my hibernate-configuration I use: org.hibernate.cache.EhCacheProvider
In my application I provide information about the 2nd level cache directly from ehcache. But since hibernate3 I get only zero values. My code to get the caches is:
String[] cacheNames = CacheManager.getInstance().getCacheNames();
for (String cn : cacheNames) {
print(cn);
register(CacheManager.getInstance().getCache(cn));
}
The cachenames are correct, but it seems, that hibernate uses some different cache-objects?
Another problem is, that in testcases I shutdown the sessionfactory. For every cache I get the following exception (only Warning, but I want to get rid of them :-)
17:10:16,742 [main] WARN could not destroy UpdateTimestamps cache -- at org.hibernate.cache.UpdateTimestampsCache.destroy(UpdateTimestampsCache.java:101)
org.hibernate.cache.CacheException: java.lang.IllegalStateException: The CacheManager is not alive.
at org.hibernate.cache.EhCache.destroy(EhCache.java:184)
at org.hibernate.cache.UpdateTimestampsCache.destroy(UpdateTimestampsCache.java:98)
at org.hibernate.impl.SessionFactoryImpl.close(SessionFactoryImpl.java:797)
at de.mtu.eprotas.core.persistence.impl.HibernateSessionFactoryImpl.shutdown(HibernateSessionFactoryImpl.java:197)
at de.mtu.eprotas.application.ApplicationManager.shutdown(ApplicationManager.java:539)
at de.mtu.eprotas.test.impl.RepositoryBasedTestCase.tearDown(RepositoryBasedTestCase.java:543)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.IllegalStateException: The CacheManager is not alive.
at net.sf.ehcache.CacheManager.checkStatus(CacheManager.java:660)
at net.sf.ehcache.CacheManager.removeCache(CacheManager.java:588)
at org.hibernate.cache.EhCache.destroy(EhCache.java:181)
... 18 more
With net.sf.ehcache.hibernate.EhCacheProvider as providerI get:
java.lang.NoSuchMethodError: org.hibernate.cache.CacheException.<init>(Ljava/lang/Exception;)V
at net.sf.ehcache.hibernate.EhCache.destroy(EhCache.java:179)
at org.hibernate.cache.NonstrictReadWriteCache.destroy(NonstrictReadWriteCache.java:104)
at org.hibernate.impl.SessionFactoryImpl.close(SessionFactoryImpl.java:777)
at de.mtu.eprotas.core.persistence.impl.HibernateSessionFactoryImpl.shutdown(HibernateSessionFactoryImpl.java:197)
at de.mtu.eprotas.application.ApplicationManager.shutdown(ApplicationManager.java:539)
at de.mtu.eprotas.test.impl.RepositoryBasedTestCase.tearDown(RepositoryBasedTestCase.java:543)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
|