« Return to Thread: Terracotta + Hibernate Second Level Caching Error::java.lang.AbstractMethodError: net.sf.ehcache.Cache.setCacheLoader

Terracotta + Hibernate Second Level Caching Error::java.lang.AbstractMethodError: net.sf.ehcache.Cache.setCacheLoader

by Anjitha :: Rate this Message:

Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi
 
I added ehcache 1.3.0 jar and tried. Still giving the same error.
 
Regards
Anjitha
Software Engineer
----- Original Message -----
From: anjitha@...
To: tc-users@...
Sent: Thursday, July 03, 2008 5:36 PM
Subject: Re: [tc-users] Terracotta + Hibernate Second Level Caching Error::java.lang.AbstractMethodError: net.sf.ehcache.Cache.setCacheLoader

Hi
 
Thank you very much for the reply. I did whatever you mentioned below except one : I am using ehcache-1.4.1.jar . I am using Terracotta 2.6.2 .Every required jar is in class path .But I am still recieving the old error itself. If  I remove Terracotta nature and run simply EHCache enabled , its working fine.Please help me with this issue.
 
Anticipitating your  reply.
 
Regards
Anjitha
Software Engineer
----- Original Message -----
From: amiller@...
To: tc-users@...
Sent: Thursday, July 03, 2008 2:17 PM
Subject: Re: [tc-users] Terracotta + Hibernate Second Level Caching Error::java.lang.AbstractMethodError: net.sf.ehcache.Cache.setCacheLoader

Hi, 

I notice a couple things wrong here.  I'm not sure they will solve your problem (looks more like a versioning/classpath issue), but it's a good place to start. 

1) It looks like your module declaration for Hibernate is incorrect in your tc-config.xml.  This isn't your fault as it looks like it is incorrect on the Forge docs as well.  The hibernate line should be:

<module name="tim-hibernate-3.2.5" version="1.1.2" group-id="org.terracotta.modules"/>

I'm assuming you are using Hibernate 3.2.5.  We also support Hibernate 3.1.2 although I'd recommend using 3.2.5.

2) It looks like you are missing an ehcache cache definition:

  <cache name="org.hibernate.cache.UpdateTimestampsCache"
      maxElementsInMemory="5000"
      timeToIdleSeconds="120"
      timeToLiveSeconds="120"
      eternal="true"/>

This is important for setting up the Ehcache eviction.

3) I'm not sure about whether the region attribute on the annotations should be there.  

4) Finally, you don't list your classpath, but I would double-check that you are using:
- ehcache-1.3.0.jar
- commons-logging-1.1.1.jar
- jsr107cache-1.0.jar    (from http://sourceforge.net/projects/jsr107cache/)
- hibernate-3.jar     (from Hibernate 3.2.5 release - http://sourceforge.net/project/showfiles.php?group_id=40712)


Also you might find one of these blog entries helpful for Ehcache and Hibernate:

http://unserializableone.blogspot.com/2007/09/distributed-ehcache-as-second-level.html
http://tech.puredanger.com/2008/06/17/distributed-ehcache-with-terracotta/

Alex



On Jul 3, 2008, at 12:46 AM, Anjitha wrote:

Hii
 
I am a newbie to Terrcotta. I am trying to integrate EH cache with Teracotta . I am attempting to share a Hibernate 2nd level cache using DSO .However I am getting
errors from Terracotta when hibernate attempts to populate the cache:But I am getting the following error .Please advice me on this.
 

java.lang.AbstractMethodError: net.sf.ehcache.Cache.setCacheLoader(Lnet/sf/ehcache/loader/CacheLoader;)V

at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:422)

at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:334)

at net.sf.ehcache.CacheManager.configure(CacheManager.java:293)

at net.sf.ehcache.CacheManager.__tc_wrapped_init(CacheManager.java:225)

at net.sf.ehcache.CacheManager.init(CacheManager.java)

at net.sf.ehcache.CacheManager.<init>(CacheManager.java:186)

at org.hibernate.cache.EhCacheProvider.start(EhCacheProvider.java:127)

at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:183)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)

at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)

at com.mystiqmobile.platform.db.hibernateobjects.HibernateUtil.initialize(HibernateUtil.java:49)

at com.mystiqmobile.platform.db.hibernateobjects.HibernateUtil.initialize(HibernateUtil.java:33)

at com.mystiqmobile.platform.db.hibernateobjects.test.TestDevice.main(TestDevice.java:48)


 

tc-Config .XML

 

<?xml version="1.0" encoding="UTF-8"?>

<con:tc-config xmlns:con="http://www.terracotta.org/config">

<servers>

<server host="%i" name="localhost">

<dso-port>9510</dso-port>

<jmx-port>9520</jmx-port>

<data>terracotta/server-data</data>

<logs>terracotta/server-logs</logs>

</server>

<update-check>

<enabled>true</enabled>

</update-check>

</servers>

<clients>

<logs>terracotta/client-logs</logs>

<modules>


<module name="tim-hibernate"

version="1.1.2"

group-id="org.terracotta.modules"/>


<module group-id="org.terracotta.modules" name="tim-ehcache-1.3" version="1.1.2"/>


</modules>

</clients>

</con:tc-config>

 


 

EHCache.XML

 

 

<?xml version="1.0" encoding="UTF-8"?>

<ehcache>

<diskStore path="java.io.tmpdir"/>

<defaultCache

maxElementsInMemory="50"

eternal="false"

timeToIdleSeconds="120"

timeToLiveSeconds="120"

overflowToDisk="true"

diskPersistent="false"

diskExpiryThreadIntervalSeconds="120"

memoryStoreEvictionPolicy="LRU"

/>


<cache name="TrialHibernateCache"

maxElementsInMemory="50"

eternal="false"

timeToIdleSeconds="120"

timeToLiveSeconds="120"

overflowToDisk="true"

diskPersistent="false"

diskExpiryThreadIntervalSeconds="120"

memoryStoreEvictionPolicy="LRU"

/>


<cache

name="org.hibernate.cache.StandardQueryCache"

maxElementsInMemory="5"

eternal="false"

timeToLiveSeconds="120"

overflowToDisk="true"/>

</ehcache>

My Hibernate.cfg file:::
 
 

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">




<hibernate-configuration>

<session-factory name="mydbSessionFactory">

<property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>

<property name="connection.password">root</property>

<property name="connection.url">jdbc:mysql://localhost/trialDB</property>

<property name="connection.username">root</property>

<property name="default_schema">trialDB</property>

<property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>

<property name="current_session_context_class">thread</property>

<property name="hbm2ddl.auto">update</property>


<!-- C3P0 Stuff -->


<property name="hibernate.c3p0.acquire_increment">3</property>

<property name="hibernate.c3p0.idle_test_period">14400</property>

<property name="hibernate.c3p0.timeout">25200</property>

<property name="hibernate.c3p0.max_size">15</property>

<property name="hibernate.c3p0.min_size">3</property>

<property name="hibernate.c3p0.max_statements">0</property>

<property name="hibernate.c3p0.preferredTestQuery">select 1;</property>


 

<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>

<property name="hibernate.cache.use_second_level_cache">true</property>

<property name="hibernate.cache.use_query_cache">true</property>

<property name="hibernate.cache.provider_configuration_file_resource_path">ehcache.xml</property>

<!--- here list of mapping classes ---->


</session-factory>



</session-factory>

</hibernate-configuration>


 

 

I am  annotating at Hibernate Objects(POJOS)  for enabling Cache as shown below:

@Cache (usage=CacheConcurrencyStrategy.READ_WRITE, region="TrialHibernateCache")


 

 

Any advice would be helpful.Thanking all in advance.

 
Regards
Anjitha
Software Engineer
_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

 « Return to Thread: Terracotta + Hibernate Second Level Caching Error::java.lang.AbstractMethodError: net.sf.ehcache.Cache.setCacheLoader

LightInTheBox - Buy quality products at wholesale price!