Question

I'm part of a team writing a web app that uses Hibernate Search, and we've recently tried to start to implement the use of JGroups to keep Lucene indexes on different nodes in sync with each other.

However, I've been unable to get past the most basic first steps in getting this set up, and documentation seems quite sparse.

<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="myFactory">
<property name="dataSource" ref="myDataSource"/>
<property name="persistenceXmlLocation" value="/WEB-INF/persistence.xml"/>
<property name="persistenceUnitName" value="persistenceUnit"/>
<property name="jpaVendorAdapter" ref="vendorAdapter"/>
<property name="jpaProperties">
    <props>
        <prop key="hibernate.search.worker.backend.jgroups.configurationFile">jgroups-config.xml</prop>
        <prop key="hibernate.search.default.directory_provider">infinispan</prop>
        <prop key="hibernate.search.default.indexBase">indexes</prop>
        <prop key="hibernate.search.default.worker.backend">jgroups</prop>
        <prop key="hibernate.search.services.jgroups.clusterName">MyCluster</prop>
        <prop key="hibernate.search.error_handler">log</prop>
        <prop key="hibernate.search.lucene_version">LUCENE_36</prop>
        <prop key="hibernate.search.generate_statistics">true</prop>
        <prop key="hibernate.search.jmx_enabled">true</prop>
    </props>
</property>

The key property here is hibernate.search.worker.backend.jgroups.configurationFile which gives the name of the configuration file for jgroups, which we will eventually need. I've tried putting this file in WEB-INF and in with the props files in the JBoss modules directory structure (in which other files are located and successfully loaded), but it just is not getting picked up.

In the logs I can see:

16:34:57,609 INFO  [org.hibernate.search.backend.impl.jgroups.JGroupsChannelProvider] (MSC service thread 1-1) HSEARCH000005: Starting JGroups Channel
16:34:57,609 INFO  [org.hibernate.search.backend.impl.jgroups.JGroupsChannelProvider] (MSC service thread 1-1) HSEARCH000011: Unable to use any JGroups configuration mechanisms provided in properties { hibernate.search.default.worker.backend=jgroups, hibernate.search.default.directory_provider=infinispan, hibernate.search.worker.backend.jgroups.configurationFile=jgroups-config.xml}. Using default JGroups configuration file!
16:34:59,427 INFO  [stdout] (MSC service thread 1-1) 
16:34:59,427 INFO  [stdout] (MSC service thread 1-1) -------------------------------------------------------------------
16:34:59,428 INFO  [stdout] (MSC service thread 1-1) GMS: address=LDNLPT1271-PC-17149, cluster=CrisisHubCluster, physical address=172.26.10.169:58147
16:34:59,428 INFO  [stdout] (MSC service thread 1-1) -------------------------------------------------------------------
16:35:02,448 INFO  [org.hibernate.search.backend.impl.jgroups.JGroupsMasterMessageListener] (MSC service thread 1-1) HSEARCH000015: Received new cluster view: [LDNLPT1271-PC-17149|0] [LDNLPT1271-PC-17149]
16:35:02,450 INFO  [org.hibernate.search.backend.impl.jgroups.JGroupsChannelProvider] (MSC service thread 1-1) HSEARCH000006: Connected to cluster [ MyCluster ]. The node address is LDNLPT1271-PC-17149
16:35:02,513 INFO  [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (CacheStartThread,HibernateSearch-Infinispan-cluster,LuceneIndexesMetadata) ISPN000078: Starting JGroups Channel
16:35:02,514 INFO  [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (CacheStartThread,HibernateSearch-Infinispan-cluster,LuceneIndexesMetadata) ISPN000088: Unable to use any JGroups configuration mechanisms provided in properties {}. Using default JGroups configuration!

I've truncated the list of properties in Unable to use any JGroups configuration mechanisms provided in properties as it would take up several pages, but if you look at the line, you can see it lists the property at the same time that it says it can't find it.

So, it's not picking up the config file location, and it's using a default.

Has anyone here used jgroups with Hibernate Search? Did you manage to supply a custom jgroups configuration file? How did you do it?

Was it helpful?

Solution

Right. I had to download the Hibernate Search source and step through the server start up in order to find this. I was using Hibernate 4.2, and the documentation version I was referring to was mostly for 3.2.

In between the two versions, someone renamed the property from hibernate.search.worker.backend.jgroups.configurationFile to hibernate.search.services.jgroups.configurationFile.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top