【问题标题】:Second level cache configuration using Infinispan and Hibernate in Jboss 7.1.1在 Jboss 7.1.1 中使用 Infinispan 和 Hibernate 进行二级缓存配置
【发布时间】:2013-11-24 02:30:48
【问题描述】:

我正在使用 Jboss 7.1.1 和 Hibernate。我想在单节点上配置二级缓存。

standalone.xml

<caches>
<cache name="simple" aliases="NoPassivationCache"/>
<cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/>
</caches>
<passivation-stores>
<file-passivation-store name="file"/>
</passivation-stores>
<subsystem xmlns="urn:jboss:domain:infinispan:1.2" default-cache-container="hibernate">
<cache-container name="hibernate" default-cache="local-query"> 
<local-cache name="entity">
<transaction mode="NON_XA"/>
<eviction strategy="LRU" max-entries="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<local-cache name="local-query">
<transaction mode="NONE"/>
<eviction strategy="LRU" max-entries="10000"/>
<expiration max-idle="100000"/>
<local-cache>
<local-cache name="timestamps">
<transaction mode="NONE"/>
<eviction strategy="NONE"/>
</local-cache>
</cache-container>
</subsystem>

而且,hibernate 的属性是这样的:

<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop     key="hibernate.cache.region.factory_class">org.hibernate.cache.infinispan.JndiInfinispanRegionFactory</prop>
<prop key="hibernate.cache.infinispan.cachemanager">java:CacheManager/entity</prop>

当我部署我的应用程序时,出现以下异常:

17:20:16,949 INFO  [org.hibernate.impl.SessionFactoryObjectFactory] (MSC service thread 1-2) Not binding factory to JNDI, no JNDI name configured
17:20:16,951 INFO  [org.hibernate.cache.UpdateTimestampsCache] (MSC service thread 1-2) starting update timestamps cache at region: org.hibernate.cache.UpdateTimestampsCache
17:20:16,952 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-2) Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@8deb1e: defining beans [mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0
...

org.hibernate.cache.NoCachingEnabledException 引起。二级缓存未启用使用[hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]

任何帮助将不胜感激!

【问题讨论】:

    标签: hibernate jboss7.x infinispan


    【解决方案1】:

    请检查此thread 以了解您遇到的异常 (org.hibernate.cache.NoCachingEnabledException)

    【讨论】:

      猜你喜欢
      • 2015-09-07
      • 2020-05-19
      • 2017-05-20
      • 2013-09-05
      • 2014-09-11
      • 1970-01-01
      • 2014-10-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多