infinispan作为二级缓存休眠 [英] infinispan as second level cache hibernate

查看:187
本文介绍了infinispan作为二级缓存休眠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用infinispan作为hibernate的二级缓存,但总是给我以下错误:

lockquote

org.infinispan.jmx.JmxDomainConflictException :ISPN000034:
已经是JMX MBean实例
type = CacheManager,name =DefaultCacheManager已经在
'org.infinispan'JMX域下注册。如果要允许多个实例
使用相同的JMX域配置,请在
的'globalJmxStatistics'配置元素中启用'allowDuplicateDomains'
属性org.infinispan.jmx.JmxUtil.buildJmxDomain(JmxUtil.java: 51)at
org.infinispan.jmx.CacheManagerJmxRegistration.updateDomain(CacheManagerJmxRegistration.java:79)

这里是hibernate属性

  setProperty(hibernate.cache.use_second_level_cache,true); 
setProperty(hibernate.cache.use_query_cache,true);
setProperty(hibernate.cache.region.factory_class,
org.hibernate.cache.infinispan.InfinispanRegionFactory);
setProperty(hibernate.cache.infinispan.statistics,false);
setProperty(hibernate.cache.infinispan.cfg,infinispan-config.xml);

infinispan配置文件

 <?xml version =1.0encoding =UTF-8?> 
< infinispan xmlns:xsi =http://www.w3.org/2001/XMLSchema-instance
xmlns =urn:infinispan:config:7.2
xsi:schemaLocation =urn:infinispan:config:7.2
http://www.infinispan.org/schemas/infinispan-config-7.2.xsd
urn:infinispan:config:store:jdbc:7.2
http://www.infinispan.org/schemas/infinispan-cachestore-jpa-config-7.2.xsd\">

< cache-container default-cache =defaultstatistics =false>
< local-cache name =simpleCachestatistics =false>
< / local-cache>

< / cache-container>
< / infinispan>

我有两个包含两个数据源的项目,一个用于审计,另一个是主要的Web项目。
以及处于例外状态的xml值在infinispan版本7.2以后并不存在
在此先感谢您的帮助:)

解决方案将< jmx duplicate-domains =true/> 添加到< cache-container /> ;



错误信息应该更新。


Trying to use infinispan as a second level cache for hibernate but always gives me the following error

org.infinispan.jmx.JmxDomainConflictException: ISPN000034: There's already a JMX MBean instance type=CacheManager,name="DefaultCacheManager" already registered under 'org.infinispan' JMX domain. If you want to allow multiple instances configured with same JMX domain enable 'allowDuplicateDomains' attribute in 'globalJmxStatistics' config element at org.infinispan.jmx.JmxUtil.buildJmxDomain(JmxUtil.java:51) at org.infinispan.jmx.CacheManagerJmxRegistration.updateDomain(CacheManagerJmxRegistration.java:79)

and here is the hibernate properties

setProperty("hibernate.cache.use_second_level_cache", "true");
            setProperty("hibernate.cache.use_query_cache", "true");
            setProperty("hibernate.cache.region.factory_class",
             "org.hibernate.cache.infinispan.InfinispanRegionFactory");
            setProperty("hibernate.cache.infinispan.statistics", "false");
            setProperty("hibernate.cache.infinispan.cfg", "infinispan-config.xml");

the infinispan config file

<?xml version="1.0" encoding="UTF-8"?>
   <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="urn:infinispan:config:7.2"
    xsi:schemaLocation="urn:infinispan:config:7.2 
                        http://www.infinispan.org/schemas/infinispan-config-7.2.xsd
                       urn:infinispan:config:store:jdbc:7.2
                       http://www.infinispan.org/schemas/infinispan-cachestore-jpa-config-7.2.xsd">

    <cache-container default-cache="default" statistics="false">
    <local-cache name="simpleCache" statistics="false">
    </local-cache>

    </cache-container>
</infinispan>

I have two projects with two datasources , one for audit and the other is the main web project. and the xml value that is in the exception doesn't exist in infinispan version 7.2 onward thanks in advance for any help :)

解决方案

Add <jmx duplicate-domains="true" /> to <cache-container />.

The error message should be updated.

这篇关于infinispan作为二级缓存休眠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆