5 Replies Latest reply on Jul 5, 2011 9:25 AM by Sanne Grinovero

    Problem indexing a class

    Craig Ching Newbie

      I'm getting the following warning in my logs when I put an object into a cache that has indexing turned on:

       

      {quote}31 Mar 2011 13:15:50,310 WARN:Component Resolve Thread:TransactionalWorker> It appears changes are being pushed to the index out of a transaction. Register the IndexWorkFlushEventListener listener on flush to correctly manage Collections!{quote}

       

      What do I need to do to ensure that Hibernate search has a transaction?

       

      I naively added the following to my cache configuration:

       

      {code:xml}    <transaction 

            transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"

            syncRollbackPhase="false"

            syncCommitPhase="false"

            useEagerLocking="false"/>{code}

       

      And used getAdvancedCache().getTransactionManager() to surround my put() with begin() and commit(), but that didn't help and I have to admit I really don't know much about what needs to be done.

        • 1. Re: Problem indexing a class
          James Cameron Newbie

          Hi,

           

          When you ran the transaction code, did you get java.lang.IllegalStateException: Illegal
          attempt to enlist a 2PC XAResource
          ?

           

          We have the same transaction configuration but I can't run the transaction code. See

          http://community.jboss.org/message/596932#596932Transaction exception: Illegal attempt to enlist a 2PC XAResource. Do you have any advice about it?

           

          Thanks.

          • 2. Re: Problem indexing a class
            Richard Yang Apprentice

            I have the same problem. For each entry that I put into infinispan cache, I got:

            [org.hibernate.search.backend.impl.TransactionalWorker] It appears changes are being pushed to the index out of a transaction. Register the IndexWorkFlushEventListener listener on flush to correctly manage Collections!

             

            Here is my cache config:

            <infinispan-config name="epen_application" jndi-name="java:CacheManager/epen">

                    <infinispan xmlns="urn:infinispan:config:5.0">

                        <global>

                            <transport clusterName="${jboss.partition.name:DefaultPartition}-epen"

                                distributedSyncTimeout="17500">

                                <properties>

                                    <property name="stack" value="${jboss.default.jgroups.stack:udp}" />

                                </properties>

                            </transport>

                            <globalJmxStatistics enabled="true"

                                allowDuplicateDomains="true" />

                            <shutdown hookBehavior="DONT_REGISTER" />

                        </global>

                        <default>

                            <deadlockDetection enabled="true" spinDuration="1000" />

                            <invocationBatching enabled="true" />

                            <storeAsBinary enabled="true" />

                            <locking isolationLevel="READ_COMMITTED"

                                lockAcquisitionTimeout="2000" writeSkewCheck="false"

                                concurrencyLevel="5000" useLockStriping="false" />

                            <transaction syncRollbackPhase="false" syncCommitPhase="false"

                                useEagerLocking="true" eagerLockSingleNode="true" />

                            <clustering mode="distribution">

                                <l1 enabled="false" lifespan="60000" />

                                <hash numOwners="1" rehashRpcTimeout="120000" />

                                <async />

                            </clustering>

             

                        </default>

                        <namedCache name="response_record">

                            <indexing enabled="true" indexLocalOnly="true">

                           

                            <properties>

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

                            </properties>

                            </indexing>

                            <eviction maxEntries="100000" />

                            <expiration lifespan="600000" />

                        </namedCache>

                       

                       

                       

                    </infinispan>

                </infinispan-config>

             

            Does this warning mean that adding index for this entry failed or it is just a warning? How to get around it?

             

            Thanks.

            • 3. Re: Problem indexing a class
              Richard Yang Apprentice

              Also, with the index set as "ram", I sometimes got this error when I add a entry into cache:

              16:25:14,261 ERROR [org.hibernate.search.exception.impl.LogErrorHandler] Exception occurred org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@.\com.pearson.epen.bean.ResponseRecordImpl\write.lock

              Primary Failure:

                  Entity com.pearson.epen.bean.ResponseRecordImpl  Id S:5948_1  Work Type  org.hibernate.search.backend.AddLuceneWork

              : org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@.\com.pearson.epen.bean.ResponseRecordImpl\write.lock

                  at org.apache.lucene.store.Lock.obtain(Lock.java:84) [:3.2.0 1129474 - 2011-05-30 23:00:24]

                  at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1114) [:3.2.0 1129474 - 2011-05-30 23:00:24]

                  at org.hibernate.search.backend.Workspace.createNewIndexWriter(Workspace.java:202) [:3.4.0.Final]

                  at org.hibernate.search.backend.Workspace.getIndexWriter(Workspace.java:180) [:3.4.0.Final]

                  at org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor.run(PerDPQueueProcessor.java:103) [:3.4.0.Final]

                  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [:1.6.0_24]

                  at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [:1.6.0_24]

                  at java.util.concurrent.FutureTask.run(Unknown Source) [:1.6.0_24]

                  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_24]

                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_24]

                  at java.lang.Thread.run(Unknown Source) [:1.6.0_24]

               

              16:25:14,265 ERROR [org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor] Unexpected error in Lucene Backend: : java.lang.NullPointerException

                  at org.hibernate.search.backend.impl.lucene.works.AddWorkDelegate.performWork(AddWorkDelegate.java:76) [:3.4.0.Final]

                  at org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor.run(PerDPQueueProcessor.java:106) [:3.4.0.Final]

                  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [:1.6.0_24]

                  at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [:1.6.0_24]

                  at java.util.concurrent.FutureTask.run(Unknown Source) [:1.6.0_24]

                  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_24]

                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_24]

                  at java.lang.Thread.run(Unknown Source) [:1.6.0_24]

               

              16:25:14,266 ERROR [org.hibernate.search.exception.impl.LogErrorHandler] Exception occurred java.lang.NullPointerException

              Primary Failure:

                  Entity com.pearson.epen.bean.ResponseRecordImpl  Id S:5948_1  Work Type  org.hibernate.search.backend.AddLuceneWork

              : java.lang.NullPointerException

                  at org.hibernate.search.backend.impl.lucene.works.AddWorkDelegate.performWork(AddWorkDelegate.java:76) [:3.4.0.Final]

                  at org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor.run(PerDPQueueProcessor.java:106) [:3.4.0.Final]

                  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [:1.6.0_24]

                  at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [:1.6.0_24]

                  at java.util.concurrent.FutureTask.run(Unknown Source) [:1.6.0_24]

                  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_24]

                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_24]

                  at java.lang.Thread.run(Unknown Source) [:1.6.0_24]

              • 4. Re: Problem indexing a class
                Sanne Grinovero Master
                Does this warning mean that adding index for this entry failed or it is just a warning? How to get around it?

                 

                Thanks.

                It's just a warning, and in fact it applies only when this engine is used to index entities managed by Hibernate: the warning should not apply to Infinispan and I'm going to remove it from being logged. For now ignore it, thanks.

                 

                I've opened https://issues.jboss.org/browse/ISPN-1218 to track this.