-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Error while indexing in Hibernate Search
PostPosted: Wed Feb 16, 2011 4:42 am 
Beginner
Beginner

Joined: Thu Jan 06, 2011 6:19 am
Posts: 25
Hi!

I've a problem with my project. I use Hibernate (3.6.0.Final), Hibernate Search (3.3.0.Final) and Spring (3.0.5.RELEASE). I use annotations for one of my hibernate entity to create a lucene index with Hibernate Search. This works fine in my JUnit tests, but when I test this in my web application (which runs in a Tomcat), I get the following error when saving or updating this entity:

Code:
org.hibernate.annotations.common.AssertionFailure: an assertion failure occured (this may indicate a bug in Hibernate)
org.hibernate.annotations.common.AssertionFailure: Access a Sealed WorkQueue which has not been sealed
   at org.hibernate.search.backend.WorkQueue.getSealedQueue(WorkQueue.java:87)
   at org.hibernate.search.backend.impl.BatchedQueueingProcessor.performWorks(BatchedQueueingProcessor.java:128)
   at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.afterCompletion(PostTransactionWorkQueueSynchronization.java:102)
   at org.hibernate.search.backend.impl.EventSourceTransactionContext$DelegateToSynchronizationOnAfterTx.doAfterTransactionCompletion(EventSourceTransactionContext.java:189)
   at org.hibernate.engine.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:591)
   at org.hibernate.engine.ActionQueue.afterTransactionCompletion(ActionQueue.java:209)
   at org.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:602)
   at org.springframework.orm.hibernate3.SpringSessionSynchronization.afterCompletion(SpringSessionSynchronization.java:229)
   at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCompletion(TransactionSynchronizationUtils.java:168)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.invokeAfterCompletion(AbstractPlatformTransactionManager.java:996)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCompletion(AbstractPlatformTransactionManager.java:971)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:799)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:374)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy68.setFavorites(Unknown Source)

...

org.hibernate.AssertionFailure: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.HibernateException: Error while indexing in Hibernate Search (ater transaction completion)
   at org.hibernate.search.backend.impl.EventSourceTransactionContext$DelegateToSynchronizationOnAfterTx.doAfterTransactionCompletion(EventSourceTransactionContext.java:192)
   at org.hibernate.engine.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:591)
   at org.hibernate.engine.ActionQueue.afterTransactionCompletion(ActionQueue.java:209)
   at org.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:602)
   at org.springframework.orm.hibernate3.SpringSessionSynchronization.afterCompletion(SpringSessionSynchronization.java:229)
   at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCompletion(TransactionSynchronizationUtils.java:168)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.invokeAfterCompletion(AbstractPlatformTransactionManager.java:996)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCompletion(AbstractPlatformTransactionManager.java:971)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:799)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:374)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy68.setFavorites(Unknown Source)


My hibernate configuration looks like this:

Code:
<bean id="session_factory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
      <property name="dataSource" ref="${...}" />
      <property name="hibernateProperties">
         <props>
                 <prop key="hibernate.dialect">${encoway_appbase.favorite.hibernate.dialect}</prop>
                 <prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</prop>
            <prop key="hibernate.cache.use_second_level_cache">true</prop>
            <prop key="hibernate.cache.use_minimal_puts">true</prop>
            <prop key="hibernate.cache.provider_configuration_file_resource_path">${...}</prop>
            <prop key="hibernate.cache.use_query_cache">true</prop>
            <prop key="hibernate.cache.use_structured_entries">false</prop>
            <prop key="hibernate.default_entity_mode">pojo</prop>
            <prop key="hibernate.use_structured_cache">true</prop>
            <prop key="hibernate.show_sql">false</prop>
            <prop key="hibernate.hbm2ddl.auto">none</prop>
            <prop key="hibernate.default_batch_fetch_size">10</prop>
            <prop key="hibernate.generate_statistics">false</prop>
            <prop key="hibernate.jdbc.batch_size">30</prop>
            <prop key="hibernate.order_inserts">true</prop>
            <prop key="hibernate.order_updates">true</prop>
            <prop key="hibernate.search.default.directory_provider">${...}</prop>
            <prop key="hibernate.search.default.indexBase">${...}</prop>
            <prop key="hibernate.search.analyzer">${...}</prop>
            <prop key="hibernate.search.indexing_strategy">event</prop>
         </props>
      </property>
   </bean>

     <tx:annotation-driven transaction-manager="transactionManager"/>
   <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory" ref="session_factory" />
   </bean>


What could be the problem? Can you help me?

Regards, jacquipre.


Top
 Profile  
 
 Post subject: Re: Error while indexing in Hibernate Search
PostPosted: Wed Feb 16, 2011 5:41 am 
Beginner
Beginner

Joined: Thu Jan 06, 2011 6:19 am
Posts: 25
Meanwhile I found out that the transaction manager that was used while saving or updating an entity was a JPATransactionManager - although my configuration uses the HibernateTransactionManager. Another project (jar) in the web application also defines a transaction manager in its hibernate configuration, in fact an JPATransactionManager.
In the web.xml this project configuration was loaded first, before my project configuration, so the JPATransactionManager was used:

Code:
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
       classpath:another_project_with_jpa_tm_context.xml
       classpath:my_project_with_hibernate_tm_context.xml
    </param-value>
</context-param>


When I exchange the order of configuration in the web.xml the HibernateTransactionManager is used and the exception is gone.

Code:
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
       classpath:my_project_with_hibernate_tm_context.xml
       classpath:another_project_with_jpa_tm_context.xml
    </param-value>
</context-param>


Can't we use several transaction managers in a web application?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.