Migrating Infinispan xml configuration from 6.x to

2019-08-31 05:36发布

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.

2条回答
不美不萌又怎样
2楼-- · 2019-08-31 05:57

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.

查看更多
成全新的幸福
3楼-- · 2019-08-31 06:05

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.

查看更多
登录 后发表回答