3 Replies Latest reply on Oct 26, 2013 5:22 PM by andrewwinter77

    config:6.0 parsing fails, wrong type of store class

    andrewwinter77

      Hi all

       

      I've just moved from Wildfly Alpha4 to Beta1 and this has encouraged/forced me to move from Infinispan 5.2 to 6.0. I've updated my Infinispan config file using infinispan-config-6.0.xsd for reference and am having some problems. I've tried reading the docs but the relevant bits are missing

       

      The failure is around here in my config file:

       

      <default>

          <persistence>

              <store class="org.infinispan.persistence.jdbc.stringbased.JdbcStringBasedStore" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">

                  <properties>

       

      This results in the parse error

       

      Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[82,9]

      Message: Unexpected element '{urn:infinispan:config:6.0}properties'

        at org.infinispan.configuration.parsing.ParserRegistry.parseElement(ParserRegistry.java:128)

        at org.infinispan.configuration.parsing.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:37)

        at org.infinispan.configuration.parsing.Parser60.parsePersistence(Parser60.java:558)

        at org.infinispan.configuration.parsing.Parser60.parseCache(Parser60.java:150)

        at org.infinispan.configuration.parsing.Parser60.parseDefaultCache(Parser60.java:115)

       

      I've had a read through the Parser60 code. In my case, on this line

      https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/configuration/parsing/Parser60.java#L668

      store is not null but its child elements ("properties" and "async" in my case) are not being parsed because !(store instanceof SingleFileStore) hence parseStoreChildren() on line 681 is not called, so "properties" is considered to be part of the "persistence" element and parsing fails.

       

      So my question is: how do I set properties for my store? Maybe I'm using the wrong type of class for DB persistence? In my old 5.2 config file I was using org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore as the loader class so I think the 6.0 equivalent is org.infinispan.persistence.jdbc.stringbased.JdbcStringBasedStore. Should parseStoreChildren() on line 681 of Parse60 be called for other types of store besides just SingleFileStore?

       

      Thanks all

       

      Andrew.

        • 1. Re: config:6.0 parsing fails, wrong type of store class
          pruivo

          Hi Andrew.

           

          Each cache store/loader type has it own parser. Please take a look at this example to see the new syntax.


          <persistence>
                   <stringKeyedJdbcStore fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
                      <connectionPool connectionUrl="jdbc:h2:mem:infinispan_string_based;DB_CLOSE_DELAY=-1" username="sa" driverClass="org.h2.Driver"/>
                      <stringKeyedTable dropOnExit="true" createOnStart="true" prefix="ISPN_STRING_TABLE">
                         <idColumn name="ID_COLUMN" type="VARCHAR(255)" />
                         <dataColumn name="DATA_COLUMN" type="BINARY" />
                         <timestampColumn name="TIMESTAMP_COLUMN" type="BIGINT" />
                      </stringKeyedTable>
                   </stringKeyedJdbcStore>
                </persistence>
          


          Also, you can check the schema here: https://github.com/infinispan/infinispan/blob/master/persistence/jdbc/src/main/resources/schema/infinispan-cachestore-jdbc-config-6.0.xsd

           

          Regards,

          Pedro

          • 2. Re: Re: config:6.0 parsing fails, wrong type of store class
            andrewwinter77

            Hi Pedro

             

            Thanks for the pointer - that was really useful. I'm closer to where I need to be but still get a parse error. My config file now looks like this:

             

            <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
                                        urn:infinispan:config:jdbc:6.0 http://www.infinispan.org/schemas/infinispan-cachestore-jdbc-config-6.0.xsd"
                    xmlns="urn:infinispan:config:6.0"
                   xmlns:jdbc="urn:infinispan:config:jdbc:6.0">
                <default>
                    <persistence>
                        <stringKeyedJdbcStore xmlns="urn:infinispan:config:jdbc:6.0" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">  
            

             

            but when it gets parsed I get the error

             

            Message: Unexpected element '{urn:infinispan:config:jdbc:6.0}stringKeyedJdbcStore'
              at org.infinispan.configuration.parsing.ParserRegistry.parseElement(ParserRegistry.java:128) [infinispan-core-6.0.0.Beta2.jar:6.0.0.Beta2]
              at org.infinispan.configuration.parsing.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:37) [infinispan-core-6.0.0.Beta2.jar:6.0.0.Beta2]
              at org.infinispan.configuration.parsing.Parser60.parsePersistence(Parser60.java:558) [infinispan-core-6.0.0.Beta2.jar:6.0.0.Beta2]
            

             

            I'm deploying to Wildfly 8.0.0.Beta1 and have infinispan-cachestore-jdbc-6.0.0.Beta2.jar on the classpath.


            Have you got any idea what might be causing this or tips on the best way to investigate?


            Thanks


            Andrew.

            • 3. Re: config:6.0 parsing fails, wrong type of store class
              andrewwinter77

              Hi again

               

              I've found the cause of my problem. When I said I "have infinispan-cachestore-jdbc-6.0.0.Beta2.jar on the classpath" what I meant was "I've added a dependency on the org.infinispan.cachestore.jdbc module to my application's manifest". Seemingly that isn't enough. When I bundle infinispan-cachestore-jdbc-6.0.0.Beta2.jar into my EAR parsing works just fine.

               

              Thanks again

               

              Andrew.