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