Configure sleep search with Infinispan and Wildfly

I am setting up Hibernate Search 5.5.5 to use Infinispan 8.2.2 on Wildfly 10. I configured only the Infinispan module in Wildfly, not the Hibernate search module.

Inside persistence.xml, I placed this configuration:

<property name="hibernate.search.infinispan.cachemanager_jndiname" value="java:jboss/infinispan/container/hibernateSearch" /> <property name="wildfly.jpa.hibernate.search.module" value="none" /> 

This is because it seems that Infinispan is used, but does not save the index.

All caches are configured in domain.xml, as shown below:

 <cache-container name="hibernateSearch" default-cache="LuceneIndexesData" jndi-name="java:jboss/infinispan/hibernateSearch" statistics-enabled="false"> <replicated-cache name="LuceneIndexesMetadata" mode="ASYNC"> <file-store fetch-state="false" passivation="false" preload="false" purge="false" shared="false" singleton="false"/> </replicated-cache> <replicated-cache name="LuceneIndexesLocking" mode="SYNC"> <file-store fetch-state="false" passivation="false" preload="false" purge="false" shared="false" singleton="false"/> </replicated-cache> <replicated-cache name="LuceneIndexesData" mode="ASYNC"> <file-store fetch-state="false" passivation="false" preload="false" purge="false" shared="false" singleton="false"/> </replicated-cache> </cache-container> 

in jboss-deployment-structure.xml:

 <module name="org.infinispan" slot="ispn-8.2"/> <module name="org.hibernate.search.orm" services="export" /> 

When I try to index everything, I get this error:

 UNHANDLED_EXCEPTION: java.lang.IllegalArgumentException: java.lang.Object is not an indexed entity or a subclass of an indexed entity 

But if I delete this line:

 <property name="wildfly.jpa.hibernate.search.module" value="none" /> 

I got

 org.hibernate.search.exception.SearchException: Wrong configuration of directory provider: class org.infinispan.hibernate.search.spi.InfinispanDirectoryProvider does not implement interface org.hibernate.search.store.DirectoryProvider 

The problem seems to be the same as described here:

https://developer.jboss.org/thread/271789

But I do not find any working solution, and I am sure that I do not have one or more versions of Infinispan or Hibernate in my class path.

What's wrong?: (

+7
java hibernate hibernate-search wildfly infinispan
source share
1 answer

TL; DR; You have 2 versions of Infinispan in your class path: one in your jboss-deployment-structure.xml and one with the org.jboss.as.clustering subsystem.

User search in sleep mode

<property name="wildfly.jpa.hibernate.search.module" value="none" /> just means that it is not automatically used to use and export the Search application server for my application.

Thus, <module name="org.hibernate.search.orm" services="export" /> is redundant, this will be done automatically as soon as you put the correct module identifier for wildfly.jpa.hibernate.search.module instead of none or just remove the property to use the default search module.

The none option exists for situations where you do not want to use the default module or the custom search module, but link it in your application.

More WildFly 10 Documents - Using Hibernate Search

WildFly Infinispan Custom Subsystem

<module name="org.infinispan" slot="ispn-8.2"/> does not update the WildFly Infinispan subsystem. This allows your application to directly use Infinispan as a library. The correct way would be one of:

  • Easy: upgrade to Wildfly 10.1 (it comes with Infinispan 8.2 and Hibernate Search 5.5 by default)
  • Hard: upgrade or modify the org.jboss.as.clustering.infinispan module to use the custom version of Infinispan
  • Absurdity: remove the cache infrastructure provided with WildFly and use your own kit and configured in the application
+2
source share

All Articles