0 Replies Latest reply on Aug 7, 2015 5:10 AM by Daniel Nuss

    ClassCastException in EAP 6.4 when using HibernateSearch and infinispan lucene directory

    Daniel Nuss Newbie

      Hi,

       

      i tried to migrate from JBoss EAP 6.2 to EAP 6.4. I have problems regarding the integration of HibernateSearch in connection with the infinispan lucene directory (using a clustered environment of JBoss). In JBoss EAP 6.2, i just copied the modules provided by HibernateSearch into the JBoss module folder and everything was working fine. Now, i used the JDG modules instead, as i did not find compatible HibernateSearch module versions (and HibernateSearch is integrated in JBoss EAP 6.4 now, anyway). Here are the configuration details:

       

      hibernate search properties in persistence.xml:

            <property name="hibernate.search.default.directory_provider" value="infinispan" />

            <property name="hibernate.search.infinispan.cachemanager_jndiname" value="java:jboss/infinispan/hibernateSearch" />

       

      JBoss infinispan subsystem configuration:

            <cache-container name="hibernateSearch" default-cache="LuceneIndexesData" jndi-name="java:jboss/infinispan/hibernateSearch" start="EAGER">

            <transport lock-timeout="60000"/>

            <distributed-cache name="LuceneIndexesData" mode="SYNC" start="EAGER"/>

            <distributed-cache name="LuceneIndexesMetadata" mode="SYNC" start="EAGER"/>

            <distributed-cache name="LuceneIndexesLocking" mode="SYNC" start="EAGER"/>

            </cache-container>

       

      Comments on modules:

      installed JDG 6.5 modules into EAP 6.4

      the application references Hibernate search orm in version hibernate-search-orm-4.6.0.Final-redhat-2, which integrates the infinispan-storage provided by JDG via its referenced engine module by the following line in the module.xml:

              <module name="org.hibernate.search.infinispan-storage" slot="jdg-6.4" services="import" optional="true" />

       

      When deploying my application, i keep getting the following ClassCastException and just don't know how to resolve it:

       

      Caused by: org.hibernate.search.SearchException: Unable to initialize directory provider: de.path.to.my.IndexedEntity

              at org.hibernate.search.store.impl.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:91)

              at org.hibernate.search.indexes.impl.DirectoryBasedIndexManager.createDirectoryProvider(DirectoryBasedIndexManager.java:212)

              at org.hibernate.search.indexes.impl.DirectoryBasedIndexManager.initialize(DirectoryBasedIndexManager.java:99)

              at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:261)

              ... 29 more

      Caused by: java.lang.ClassCastException: org.jboss.as.clustering.infinispan.DefaultCacheContainer cannot be cast to org.infinispan.manager.EmbeddedCacheManager

              at org.hibernate.search.infinispan.CacheManagerServiceProvider.locateCacheManager(CacheManagerServiceProvider.java:125)

              at org.hibernate.search.infinispan.CacheManagerServiceProvider.start(CacheManagerServiceProvider.java:116)

              at org.hibernate.search.engine.impl.StandardServiceManager$ServiceProviderWrapper.startVirtual(StandardServiceManager.java:181)

              at org.hibernate.search.engine.impl.StandardServiceManager.requestService(StandardServiceManager.java:125)

              at org.hibernate.search.infinispan.impl.InfinispanDirectoryProvider.initialize(InfinispanDirectoryProvider.java:93)

              at org.hibernate.search.store.impl.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:88)

              ... 32 more

       

       

      Do you have any idea how to fix this? Any kind of help would be appreciated.