2 Replies Latest reply on Jan 11, 2012 1:17 PM by RASELINARY Johan

    JdbcStringBasedCacheStore - Unsupported key type: 'org.infinispan.lucene.FileListCacheKey'

    RASELINARY Johan Newbie

      Hi,

       

      I try to use JdbcStringBasedCacheStore as Infinispan CacheLoader.

       

      Ihave the configuration below :

      • Spring MVC + transaction local container managed (Spring 3.1) 
      • JPA/Hibernate (Hibernate 4.0.0.FINAL) 
      • Hibernate Search (4.0.0.FINAL) 
      • Infinispan as Directory Provider (5.0.1.FINAL)

       

       

      When I start the webapp, I get this Exception below

       

      2012-01-11 16:10:52,315  INFO [Thread-1] (AbstractComponentRegistry.java:688) - ISPN000128: Infinispan version: Infinispan 'Pagoa' 5.0.1.FINAL

      2012-01-11 16:10:52,393 ERROR [Thread-1] (InvocationContextInterceptor.java:111) - ISPN000136: Execution error

      org.infinispan.loaders.keymappers.UnsupportedKeyTypeException: Unsupported key type: 'org.infinispan.lucene.FileListCacheKey' on key: *|content

      at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.getLockFromKey(JdbcStringBasedCacheStore.java:195)

      at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.getLockFromKey(JdbcStringBasedCacheStore.java:87)

      at org.infinispan.loaders.LockSupportCacheStore.load(LockSupportCacheStore.java:127)

      at org.infinispan.loaders.decorators.AbstractDelegatingStore.load(AbstractDelegatingStore.java:108)

      at org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeeded(CacheLoaderInterceptor.java:149)

      at org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeededAndUpdateStats(CacheLoaderInterceptor.java:218)

      at org.infinispan.interceptors.CacheLoaderInterceptor.visitGetKeyValueCommand(CacheLoaderInterceptor.java:90)

      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:61)

      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

      at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:133)

      at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:90)

      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:61)

      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

      at org.infinispan.interceptors.TxInterceptor.enlistReadAndInvokeNext(TxInterceptor.java:201)

      at org.infinispan.interceptors.TxInterceptor.visitGetKeyValueCommand(TxInterceptor.java:192)

      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:61)

      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

      at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:104)

      at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:64)

      at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:90)

      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:61)

      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

      at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:133)

      at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:90)

      at org.infinispan.interceptors.IsMarshallableInterceptor.visitGetKeyValueCommand(IsMarshallableInterceptor.java:80)

      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:61)

      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

      at org.infinispan.interceptors.BatchingInterceptor.handleDefault(BatchingInterceptor.java:77)

      at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:90)

      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:61)

      at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:274)

      at org.infinispan.CacheImpl.get(CacheImpl.java:242)

      at org.infinispan.lucene.FileListOperations.getFileList(FileListOperations.java:55)

      at org.infinispan.lucene.InfinispanDirectory.list(InfinispanDirectory.java:183)

      at org.infinispan.lucene.InfinispanDirectory.listAll(InfinispanDirectory.java:338)

      at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:641)

      at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:593)

      at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:359)

      at org.apache.lucene.index.IndexReader.indexExists(IndexReader.java:801)

      at org.hibernate.search.store.impl.DirectoryProviderHelper.initializeIndexIfNeeded(DirectoryProviderHelper.java:157)

       

       

      Index content class

      @Entity
      @Indexed(index = "content")
      @Table(name = "content")
      public class Content implements java.io.Serializable {
      private static final long serialVersionUID = -581670305255330806L;
      @Field(analyze = Analyze.NO, store = Store.YES)
      private Long contentId;
      @Field(analyze = Analyze.NO, store = Store.YES)

      ...

      }

      Infinispan config

      <namedCache
              name="LuceneIndexesMetadata">
              <loaders shared="true" preload="true" passivation="false">     
         <loader class="org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore" fetchPersistentState="true" ignoreModifications="false" purgeOnStartup="false">
          <properties>
           <property name="stringsTableNamePrefix" value="ISPN_STRING_TABLE"/>
           <property name="idColumnName" value="ID_COLUMN"/>
           <property name="dataColumnName" value="DATA_COLUMN"/>
           <property name="timestampColumnName" value="TIMESTAMP_COLUMN"/>
           <property name="timestampColumnType" value="BIGINT"/>
           <property name="connectionFactoryClass" value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory"/>
           <property name="connectionUrl" value="jdbc:mysql://localhost:3306/scmcloud"/>
           <property name="userName" value="xxx"/>
           <property name="password" value="xxx"/>
           <property name="driverClass" value="com.mysql.jdbc.Driver"/>
           <property name="idColumnType" value="VARCHAR(255)"/>
           <property name="dataColumnType" value="BLOB"/>
           <property name="dropTableOnExit" value="true"/>
           <property name="createTableOnStart" value="true"/>
          
          </properties>
           <!-- write-behind configuration starts here -->       
           <async enabled="true" threadPoolSize="10" />
           <!-- write-behind configuration ends here -->
            </loader>
        </loaders>
              <clustering
                  mode="replication">
                  <stateRetrieval
                      fetchInMemoryState="true"
                      logFlushTimeout="30000" />
                  <sync
                      replTimeout="25000" />
              </clustering>
          </namedCache>

          <!-- **************************** -->
          <!--  Cache to store Lucene data  -->
          <!-- **************************** -->
          <namedCache
              name="LuceneIndexesData">
              <loaders shared="true" preload="true" passivation="false">     
         <loader class="org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore" fetchPersistentState="true" ignoreModifications="false" purgeOnStartup="false">
          <properties>
           <property name="stringsTableNamePrefix" value="ISPN_STRING_TABLE"/>
           <property name="idColumnName" value="ID_COLUMN"/>
           <property name="dataColumnName" value="DATA_COLUMN"/>
           <property name="timestampColumnName" value="TIMESTAMP_COLUMN"/>
           <property name="timestampColumnType" value="BIGINT"/>
           <property name="connectionFactoryClass" value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory"/>
           <property name="connectionUrl" value="jdbc:mysql://localhost:3306/scmcloud"/>
           <property name="userName" value="xxx"/>
           <property name="password" value="xxxx"/>
           <property name="driverClass" value="com.mysql.jdbc.Driver"/>
           <property name="idColumnType" value="VARCHAR(255)"/>
           <property name="dataColumnType" value="TRUE"/>
           <property name="dropTableOnExit" value="true"/>
           <property name="createTableOnStart" value="true"/>
          
          </properties>
           <!-- write-behind configuration starts here -->       
           <async enabled="true" threadPoolSize="10" />
           <!-- write-behind configuration ends here -->
            </loader>
        </loaders>
              <clustering
                  mode="replication">
                  <stateRetrieval
                      fetchInMemoryState="true"
                      logFlushTimeout="30000" />
                  <sync
                      replTimeout="25000" />
              </clustering>
          </namedCache>

      SQL Table content

      CREATE TABLE `content` (
        `content_id` bigint(20) NOT NULL AUTO_INCREMENT,
        `content_expire_on` date DEFAULT NULL,
        `content_hit_counter` int(11) NOT NULL,

      ...

      )

      persistence.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
      <persistence-unit name="scmPU">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <properties>
         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
               <property name="hibernate.search.default.directory_provider" value="infinispan"/>
               <property name="hibernate.search.infinispan.chunk_size" value="300000000" />
                 <property name="hibernate.search.infinispan.configuration_resourcename" value="infinispan-config.xml"/>
                  <property name="hibernate.search.default.optimizer.operation_limit.max" value="1000"/>
            <property name="hibernate.search.default.optimizer.transaction_limit.max" value="100"/>
            <property name="hibernate.search.default.indexwriter.batch.max_merge_docs" value="10000"/>
            <property name="hibernate.search.worker.execution" value="async"/>
            <property name="hibernate.search.worker.thread_pool.size" value="10"/>
           
         <property name="hibernate.format_sql" value="false"/>
         <property name="hibernate.connection.release_mode" value="auto" />
              </properties>
      </persistence-unit>
      </persistence>

      Maybe I missed the concept of "type of key to be persisted" into JDBCCacheLoader?

      Regards