Reputation: 980
I'm trying to connect my application to a Terracotta cluster of caches, but I'm having trouble starting my application with the configurations I've set up. I don't get any errors in the console, but if I go with debug it fails when it tries to create the CacheManager.
The error I get is this. Caused by: java.lang.ClassNotFoundException: net.sf.ehcache.config.TerracottaConfigConfiguration
I'm using Hibernate 4.x, Spring 4.x, Terracotta BigMemory Max 4.x.
Could you tell me what I'm doing wrong or where I could find an up to date documentation?
These are my configurations:
Hibernate properties:
<prop key="hibernate.cache.use_structured_entries">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="net.sf.ehcache.configurationResourceName">ehcache-hibernate.xml</prop>
Ehcache-hibernate.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache name="ehcache-hibernate"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<cache name="User" maxElementsInMemory="1000"
maxElementsOnDisk="10000" eternal="false" timeToIdleSeconds="3600"
timeToLiveSeconds="1200" memoryStoreEvictionPolicy="LFU">
<terracotta />
</cache>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="1200"
timeToLiveSeconds="1200">
<!--<terracotta />-->
</defaultCache>
<terracottaConfig url="localhost:9510" />
Maven related dependencies:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>4.3.10.Final</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-terracotta</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.terracotta</groupId>
<artifactId>terracotta-toolkit-1.6-runtime-ee</artifactId>
<version>5.8.0</version>
</dependency>
<dependency>
<groupId>org.terracotta</groupId>
<artifactId>terracotta-toolkit-runtime-ee</artifactId>
<version>4.1.1</version>
</dependency>
I'm on Windows and I've started both the Terracotta server and the management console. The server shows up as active, but there are no clients connected to it.
I've tried to find examples of valid configurations using an environment similar to my own but couldn't find any.
Thank you!
Upvotes: 1
Views: 1096
Reputation: 1250
I fear you won't get this working. I don't know of a code base (even non-official) that would support Terracotta 4.1 with Hibernate 4.x. It could well be my memory fails me here, but ...
The best you could try is using the Ehcache embedded Hibernate 2LC provider classes instead (within the net.sf.ehcache
package), but I think these don't support the Hibernate 4.x SPI.
Upvotes: 0
Reputation: 14651
You are missing ehcache-core
from your classpath. Add the following dependency to make it work:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.1.1</version>
</dependency>
Upvotes: 1