Migrating Infinispan xml configuration from 6.x to 7.x

爷,独闯天下 提交于 2019-12-25 01:37:49

问题


I've been using Infinispan 6.x and I have a couple of XML configuration files. Now I want to migrate to 7.x, but I'm having exceptions when the new version tries to parse the old configuration files. Here is my configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="urn:infinispan:config:6.0 http://www.infinispan.org/schemas/infinispan-config-6.0.xsd">
  <global>
    <globalJmxStatistics enabled="false" mBeanServerLookup="dz.lab.cache.infinispan.DummyMBeanServer$DummyLoockup" />
  </global>
  <default>    
    <eviction strategy="NONE" />
    <expiration lifespan="-1" maxIdle="-1" />
    <clustering mode="local">
      <hash>
        <groups enabled="true" />
      </hash>
    </clustering>
    <transaction transactionManagerLookupClass="org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup" transactionMode="TRANSACTIONAL" lockingMode="OPTIMISTIC" />
    <invocationBatching enabled="true" />
    <locking supportsConcurrentUpdates="true" />    
  </default>
</infinispan>

and the full stacktrace:

org.infinispan.commons.CacheConfigurationException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[7,11]
Message: Unexpected element 'global' encountered
    at org.infinispan.configuration.parsing.ParseUtils.unexpectedElement(ParseUtils.java:35)
    at org.infinispan.configuration.parsing.Parser70.readElement(Parser70.java:96)
    at org.infinispan.configuration.parsing.ParserRegistry.parseElement(ParserRegistry.java:133)
    at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:115)
    at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:102)
    at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:89)
    ... 30 more

How do I migrate this configuration? I can't find hints on the official user guide.


回答1:


Your configuration should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<infinispan
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:infinispan:config:7.0 http://www.infinispan.org/schemas/infinispan-config-7.0.xsd"
        xmlns="urn:infinispan:config:7.0">
    <cache-container name="default" default-cache="defaultCache">
        <serialization />
        <jmx>
            <property name="enabled">true</property>
        </jmx>
        <local-cache name="defaultCache">
          ...
        </local-cache>
    </cache-container>
</infinispan>

See the schema for all the transaction, isolation, eviction etc. elements - those are very similar.




回答2:


Upgrade guide might be found here. Please upgrade your xml schema to 7.0 (or 7.1) and recreate your configuration. global xml element is now called cache-container, here is an example.



来源:https://stackoverflow.com/questions/28021468/migrating-infinispan-xml-configuration-from-6-x-to-7-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!