java – infinispan作为二级缓存hibernate

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

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)

这是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.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>

我有两个项目有两个数据源,一个用于审计,另一个是主要的Web项目.
并且infinispan版本7.2以后版本中不存在xml值
在此先感谢任何帮助:)

最佳答案
添加< jmx duplicate-domains =“true”/>到< cache-container />.

应该更新错误消息.

转载注明原文:java – infinispan作为二级缓存hibernate - 代码日志