-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate3, ehcache statistics are empty and shutdown warn..
PostPosted: Thu Jun 28, 2007 11:51 am 
Newbie

Joined: Wed Feb 08, 2006 5:57 am
Posts: 7
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)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 28, 2007 1:22 pm 
Beginner
Beginner

Joined: Mon May 21, 2007 5:22 pm
Posts: 27
Location: Salt Lake City
Sounds like you are having the configuration issue with the Ehcache.
It seems the status is not alive for your registered caches.

Provide some detail information, may be i can help you in this matter further.

_________________
Try 'N' Enjoy !!
Rahul

If helpful do rating ....


Last edited by rahul dongre on Tue Jul 03, 2007 12:16 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Solution found
PostPosted: Tue Jul 03, 2007 4:09 am 
Newbie

Joined: Wed Feb 08, 2006 5:57 am
Posts: 7
Hi,
thank you for your help, meantime I've found solutions for my problems.
First I must use the net.sf.ehcache.hibernate.SingletonEhCacheProvider class, otherwise CacheManager.getInstance() won't get the current used cachemanager.

The other problem was that in testcases the sessionfactory was closed twice ...

bye
Roland


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.