【发布时间】:2016-01-12 17:42:48
【问题描述】:
我正在尝试将我的应用程序连接到一个 Terracotta 缓存集群,但我无法使用我设置的配置启动我的应用程序。我在控制台中没有收到任何错误,但是如果我进行调试,它会在尝试创建 CacheManager 时失败。
我得到的错误是这样的。引起:java.lang.ClassNotFoundException: net.sf.ehcache.config.TerracottaConfiguration
我正在使用 Hibernate 4.x、Spring 4.x、Terracotta BigMemory Max 4.x。
您能告诉我我做错了什么或在哪里可以找到最新的文档吗?
这些是我的配置:
休眠属性:
<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相关依赖:
<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>
我在 Windows 上,我已经启动了 Terracotta 服务器和管理控制台。服务器显示为活动的,但没有客户端连接到它。
我尝试使用类似于我自己的环境来查找有效配置的示例,但找不到任何示例。
谢谢!
【问题讨论】:
-
我们将为此需要一条错误消息。
-
看来我遇到了日志记录问题,错误没有出现。我明白了: 引起:java.lang.ClassNotFoundException: net.sf.ehcache.config.TerracottaConfiguration
标签: java spring hibernate ehcache terracotta