Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-1576

Support Infinispan as the Hibernate Search directory provider

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0.0.Alpha7
    • Component/s: None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

      Description

      Original, misplaced request: https://bugzilla.redhat.com/show_bug.cgi?id=1081556

      Description of problem:

      When using Infinispan as the Hibernate Search directory provider, the following exception is encountered:

      10:42:08,757 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool – 129) MSC000001: Failed to start service jboss.persistenceunit."MenuProject-ear.ear/MenuProject-dataModel-0.1-SNAPSHOT.jar#MenuProject": org.jboss.msc.service.StartException in service jboss.persistenceunit."MenuProject-ear.ear/MenuProject-dataModel-0.1-SNAPSHOT.jar#MenuProject": org.hibernate.search.SearchException: HSEARCH000103: Unable to initialize IndexManager net.odyssi.projectx.persistence.model.products.ProductReviewCommentBean
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
      at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
      at org.jboss.threads.JBossThread.run(JBossThread.java:122)
      Caused by: org.hibernate.search.SearchException: HSEARCH000103: Unable to initialize IndexManager net.odyssi.projectx.persistence.model.products.ProductReviewCommentBean
      at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:265)
      at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:528)
      at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManagers(IndexManagerHolder.java:495)
      at org.hibernate.search.indexes.impl.IndexManagerHolder.buildEntityIndexBinding(IndexManagerHolder.java:104)
      at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:359)
      at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:217)
      at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:141)
      at org.hibernate.search.hcore.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:74)
      at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:52)
      at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:572)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1794)
      at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899)
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76)
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)
      ... 4 more
      Caused by: java.lang.ClassCastException: java.lang.Class cannot be cast to org.infinispan.loaders.bucket.Bucket
      at org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStore.loadBucket(JdbcBinaryCacheStore.java:286)
      at org.infinispan.loaders.bucket.BucketBasedCacheStore.loadLockSafe(BucketBasedCacheStore.java:60)
      at org.infinispan.loaders.bucket.BucketBasedCacheStore.loadLockSafe(BucketBasedCacheStore.java:49)
      at org.infinispan.loaders.LockSupportCacheStore.load(LockSupportCacheStore.java:142)
      at org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeeded(CacheLoaderInterceptor.java:186)
      at org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeededAndUpdateStats(CacheLoaderInterceptor.java:252)
      at org.infinispan.interceptors.CacheLoaderInterceptor.visitGetKeyValueCommand(CacheLoaderInterceptor.java:119)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
      at org.infinispan.interceptors.EntryWrappingInterceptor.visitGetKeyValueCommand(EntryWrappingInterceptor.java:126)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
      at org.infinispan.interceptors.locking.NonTransactionalLockingInterceptor.visitGetKeyValueCommand(NonTransactionalLockingInterceptor.java:60)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
      at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:134)
      at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:104)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
      at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:134)
      at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:104)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
      at org.infinispan.statetransfer.StateTransferInterceptor.handleTopologyAffectedCommand(StateTransferInterceptor.java:216)
      at org.infinispan.statetransfer.StateTransferInterceptor.handleDefault(StateTransferInterceptor.java:200)
      at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:104)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
      at org.infinispan.interceptors.CacheMgmtInterceptor.visitGetKeyValueCommand(CacheMgmtInterceptor.java:92)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
      at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:128)
      at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:92)
      at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:104)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)
      at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:343)
      at org.infinispan.CacheImpl.get(CacheImpl.java:289)
      at org.infinispan.DecoratedCache.get(DecoratedCache.java:315)
      at org.infinispan.AbstractDelegatingCache.get(AbstractDelegatingCache.java:303)
      at org.infinispan.lucene.impl.FileListOperations.getFileList(FileListOperations.java:66)
      at org.infinispan.lucene.InfinispanDirectory.list(InfinispanDirectory.java:168)
      at org.infinispan.lucene.InfinispanDirectory.listAll(InfinispanDirectory.java:328)
      at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:602)
      at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:554)
      at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:359)
      at org.apache.lucene.index.IndexReader.indexExists(IndexReader.java:1099)
      at org.hibernate.search.store.impl.DirectoryProviderHelper.initializeIndexIfNeeded(DirectoryProviderHelper.java:155)
      at org.hibernate.search.infinispan.impl.InfinispanDirectoryProvider.start(InfinispanDirectoryProvider.java:103)
      at org.hibernate.search.indexes.impl.DirectoryBasedIndexManager.initialize(DirectoryBasedIndexManager.java:103)
      at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:261)
      ... 21 more

      How reproducible:

      The following cache-container configuration is in place in JBoss EAP 6.2.0:

      <cache-container name="hibernateSearch" default-cache="LuceneIndexesData" jndi-name="java:jboss/infinispan/hibernateSearch" start="EAGER">
          <transport lock-timeout="60000"/>
          <replicated-cache name="LuceneIndexesMetadata" mode="SYNC" start="EAGER">
             <binary-keyed-jdbc-store datasource="java:jboss/datasources/InfinispanDatasource" shared="true" passivation="false" purge="false">
                  <property name="createTableOnStart">true</property>
                  <binary-keyed-table>
                      <id-column name="ID_COLUMN" type="VARCHAR(255)"/>
                      <data-column name="DATUM" type="BYTEA"/>
                  </binary-keyed-table>
              </binary-keyed-jdbc-store>
          </replicated-cache>
          <replicated-cache name="LuceneIndexesData" mode="SYNC" start="EAGER">
              <binary-keyed-jdbc-store datasource="java:jboss/datasources/InfinispanDatasource" shared="true" passivation="false" purge="false">
                  <property name="createTableOnStart">true</property>
                  <binary-keyed-table>
                      <id-column name="ID_COLUMN" type="VARCHAR(255)"/>
                      <data-column name="DATUM" type="BYTEA"/>
                  </binary-keyed-table>
              </binary-keyed-jdbc-store>
          </replicated-cache>
          <replicated-cache name="LuceneIndexesLocking" mode="SYNC" start="EAGER"/>
      </cache-container>
      

      Below is the relevant portion of persistence.xml:

      <!-- Hibernate Search properties - Infinispan -->
      <property name="hibernate.search.infinispan.cachemanager_jndiname" value="java:jboss/infinispan/hibernateSearch" />
      <property name="hibernate.search.default.directory_provider" value="infinispan" />
      <property name="hibernate.search.infinispan.chunk_size" value="300000000" />
      <property name="hibernate.search.reader.strategy" value="shared" />
      <property name="hibernate.search.worker.execution" value="sync" />
      <property name="hibernate.search.jmx_enabled" value="true" />
      <property name="hibernate.search.autoregister_listeners" value="true" />
      

      Steps to Reproduce:
      1. Configure JBoss EAP as shown
      2. Configure persistence.xml as shown
      3. Attempt to write an @Indexed entity to the datastore

      Actual results:

      The exception shown above

      Expected results:

      The entity is written to the datastore, and is indexed in the Infinispan-backed Hibernate Search index

        Attachments

          Activity

            People

            • Assignee:
              sanne Sanne Grinovero
              Reporter:
              brmeyer Brett Meyer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: