-->
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.  [ 8 posts ] 
Author Message
 Post subject: Crash when using ehcache and hibernate 3.2 rc2
PostPosted: Sat May 13, 2006 8:05 pm 
Newbie

Joined: Wed Jun 15, 2005 9:18 am
Posts: 11
Hibernate version:
hibernate-3.2-rc2.jar
hibernate-annotations-3.1beta10.jar
hibernate-entitymanager-3.1beta8.jar
ehcache-1.2.jar

Full stack trace of any exception that occurs:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [appCtxDal.xml]: Invocation of init method failed; nested exception is org.hibernate.cache.CacheException: Attempt to restart an already started EhCacheProvider. Use sessionFactory.close() between repeated calls to buildSessionFactory. Consider using net.sf.ehcache.hibernate.SingletonEhCacheProvider. Error from ehcache was: Cannot parseConfiguration CacheManager. Attempt to create a new instance of CacheManager using the diskStorePath "null" which is already used by an existing CacheManager. The source of the configuration was classpath.
Caused by: org.hibernate.cache.CacheException: Attempt to restart an already started EhCacheProvider. Use sessionFactory.close() between repeated calls to buildSessionFactory. Consider using net.sf.ehcache.hibernate.SingletonEhCacheProvider. Error from ehcache was: Cannot parseConfiguration CacheManager. Attempt to create a new instance of CacheManager using the diskStorePath "null" which is already used by an existing CacheManager. The source of the configuration was classpath.


Name and version of the database you are using:
Sql server 2005 express

Hello,

I use hibernate 3.2 rc2 with spring 2.0 RC1 (and jpa), I get a crash (see above) when using ehcache (whatever the ehcache version).

hibernate 3.2 rc1 with ehcache 1.1 or ehcache 1.2 : ok
hibernate 3.2 rc2 with ehcache 1.1 or ehcache 1.2 : crash
hibernate 3.2 rc2 with treecache : ok (I just replace 'org.hibernate.cache.EhCacheProvider' by 'org.hibernate.cache.TreeCacheProvider' for the hibernate.cache.provider_class property).

In the stack trace I can read "Consider using net.sf.ehcache.hibernate.SingletonEhCacheProvider" but this class does not even exist in ehcache.jar.

The ehcache.xml is very simple :

<ehcache>
<defaultCache
maxElementsInMemory="0"
eternal="false"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
overflowToDisk="false"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="0"
/>

<cache name="eg.Category"
maxElementsInMemory="25"
eternal="false"
timeToIdleSeconds="86400"
timeToLiveSeconds="86400"
overflowToDisk="false"
/>
</ehcache>

An idea ? I doubt it commes from spring because everything works with hibernate 3.2 rc1 (and rc2 with treecache).

Thanks,

Gengis


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 16, 2006 2:01 pm 
Newbie

Joined: Sun Mar 12, 2006 7:47 pm
Posts: 5
Out of curiosity, do you have multiple session factories in your application? I have an app with multiple databases (and thus multiple session factories) and I'm seeing this problem as well. I was curious if that might be part of the issue.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 16, 2006 2:07 pm 
Newbie

Joined: Sun Mar 12, 2006 7:47 pm
Posts: 5
It appears as though there is a new release of EHCache (1.2.1) that appears to deal with this. Kind of a pain that this wasn't part of the Hibernate release. I'll test and perhaps put that in JIRA if I can't find it there already...


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 16, 2006 4:03 pm 
Newbie

Joined: Sun Mar 12, 2006 7:47 pm
Posts: 5
I misspoke, EHCache 1.2.1 is an *upcoming* maintenance release. You'll have to work from their latest source for now :-(. Also, the definitely seems to be related to having multiple session factories...


Top
 Profile  
 
 Post subject: Me too
PostPosted: Thu May 18, 2006 11:42 am 
Newbie

Joined: Wed Dec 07, 2005 6:31 am
Posts: 9
My application use multiple session factories and I'm experiencing this problem aswell. I guess I'll have to go back to hibernate 3.1 for now...

_________________
OJ


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 5:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
use a seperate echache configuration if you have multiple sf's

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 08, 2006 6:32 pm 
Newbie

Joined: Wed Jun 15, 2005 9:18 am
Posts: 11
Everything works fine with ehcache 1.2.2, I do not even need to use SingletonEhCacheProvider. But the diskStore element seems to be required in the xml, even if overflowToDisk is set to false.

I use hibernate 3.2 RC2, hibernate annotation 3.2 RC1, hibernate entitymanager 3.2 RC1 and Spring 2.0 RC3 nightly build


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 11:06 am 
Newbie

Joined: Tue Oct 18, 2005 8:43 am
Posts: 15
hello,
could anyone tell me how I actually do configure ehcache when I have several session factories and using Hibernate 3.2CR4?

I have an ear-file with two sar-files in it. Each of the sar-files contains an ehcache.xml together with the Hibernate-configuration in jboss-service.xml and all *.hbm.xml files

I still get an exception, though:
Code:
2006-10-04 16:52:38,987 FATAL [no.statnett.ge.server.db.HibernateService] Failed to get session from the hibernate connection factory. No connection to database.
org.hibernate.cache.CacheException: Attempt to restart an already started EhCacheProvider. Use sessionFactory.close()  between repeated calls to buildSessionFactory. Consider using net.sf.ehcache.hibernate.SingletonEhCacheProvider.


Both ehcache.xml files look the same, it is just a copy of ehcache-failsafe.xml. I have also experimented with adding a <cache name=".."..> element to both of the files, but they still give me the "Attempt to restart..." exception.

I have searched the ehcache documentations and also been looking through these forums, but I have found no solution. Also, I would like to stick to the ehcache version distributed with Hibernate (1.2) instead of upgrading to 1.2.1, which I read is a workaround.

my jboss-service.xml:
Code:
<server>
    <mbean code="org.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory,name=HibernateGE">
        <depends>jboss.jca:service=RARDeployer</depends>
        <!-- Make it deploy ONLY after DataSource had been started -->
        <depends>jboss.jca:service=LocalTxCM,name=OracleDS</depends>

        <attribute name="JndiName">java:/hibernate/GESessionFactory</attribute>
        <attribute name="Datasource">java:/OracleDS</attribute>
        <attribute name="Dialect">org.hibernate.dialect.Oracle9Dialect</attribute>
        <attribute name="MaximumFetchDepth">5</attribute>
        <attribute name="ShowSqlEnabled">false</attribute>       

       <!-- Transaction integration -->
        <attribute name="TransactionStrategy">org.hibernate.transaction.JDBCTransactionFactory</attribute>
        <attribute name="TransactionManagerLookupStrategy">org.hibernate.transaction.JBossTransactionManagerLookup</attribute>
        <attribute name="FlushBeforeCompletionEnabled">true</attribute>
        <attribute name="AutoCloseSessionEnabled">false</attribute>

       <!-- Second-level caching -->
        <attribute name="SecondLevelCacheEnabled">true</attribute>
        <attribute name="CacheProviderClass">org.hibernate.cache.EhCacheProvider</attribute>
        <attribute name="QueryCacheEnabled">true</attribute>
        <!-- Map files -->
        <attribute name="MapResources">
            com/jalla/ge/generated/Component.hbm.xml,
            com/jalla/ge/generated/Section.hbm.xml,
        </attribute>       
    </mbean>
</server>


any help would be highly appreciated!

cheers,
tanstaafl


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.