Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-4941

Transaction issue after timeout using JPA binding

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jboss-fuse-6.3
    • jboss-fuse-6.2.1
    • Camel
    • None
    • % %
    • Hide

      Apply the following changes to the camel-jpa-binding quickstart:

      quickstarts/switchyard/camel-jpa-binding/src/main/java/org/switchyard/quickstarts/camel/jpa/binding/GreetingServiceBean.java
      @@ -36,6 +36,12 @@ public class GreetingServiceBean implements GreetingService {
       
           @Override
           public final void greet(final Greet event) {
      +		try {
      +		   _logger.info("==> start sleeping <==");
      +			Thread.sleep(90*1000);
      +		} catch (InterruptedException e) {
      +			// TODO Auto-generated catch block
      +		}
      

      and change the global transaction timeout:

      standalone/configuration/standalone.xml
      @@ -310,7 +310,7 @@
                       </process-id>
                   </core-environment>
                   <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager" />
      -            <coordinator-environment default-timeout="300" />
      +            <coordinator-environment default-timeout="60" />
      
      Show
      Apply the following changes to the camel-jpa-binding quickstart: quickstarts/switchyard/camel-jpa-binding/src/main/java/org/switchyard/quickstarts/camel/jpa/binding/GreetingServiceBean.java @@ -36,6 +36,12 @@ public class GreetingServiceBean implements GreetingService { @Override public final void greet(final Greet event) { + try { + _logger.info("==> start sleeping <=="); + Thread.sleep(90*1000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + } and change the global transaction timeout: standalone/configuration/standalone.xml @@ -310,7 +310,7 @@ </process-id> </core-environment> <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager" /> - <coordinator-environment default-timeout="300" /> + <coordinator-environment default-timeout="60" />
    • 6.3 Sprint 3 (Feb 29 - Mar 25)

      Using JPA binding, when the processing time exceeds the transaction timeout, this breaks the subsequent polls, which fail with the following WARN message:

      06:58:32,121 WARN  [org.apache.camel.component.jpa.JpaConsumer] (Camel (camel-3) thread #2 - jpa://org.switchyard.quickstarts.camel.jpa.binding.domain.Greet) Consumer Consumer[jpa://org.switchyard.quickstarts.camel.jpa.binding.domain.Greet?consumeDelete=true&consumeLockEntity=false&consumer.transacted=true&delay=2000&initialDelay=1000&persistenceUnit=JpaEvents&transactionManager=%23jtaTransactionManager] Will try again at next poll. Caused by: [javax.persistence.PersistenceException - org.hibernate.HibernateException: Transaction was rolled back in a different thread!]: javax.persistence.PersistenceException: org.hibernate.HibernateException: Transaction was rolled back in a different thread!
      	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) [hibernate-entitymanager-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
      	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310) [hibernate-entitymanager-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
      	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1316) [hibernate-entitymanager-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
      	at org.hibernate.ejb.AbstractEntityManagerImpl.remove(AbstractEntityManagerImpl.java:911) [hibernate-entitymanager-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_60]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_60]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_60]
      	at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_60]
      	at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344) [spring-orm-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      	at com.sun.proxy.$Proxy72.remove(Unknown Source)
      	at org.apache.camel.component.jpa.JpaConsumer$5.deleteObject(JpaConsumer.java:456) [camel-jpa-2.15.1.redhat-621084.jar:2.15.1.redhat-621084]
      	at org.apache.camel.component.jpa.JpaConsumer.processBatch(JpaConsumer.java:185) [camel-jpa-2.15.1.redhat-621084.jar:2.15.1.redhat-621084]
      	at org.apache.camel.component.jpa.JpaConsumer$1.doInTransaction(JpaConsumer.java:118) [camel-jpa-2.15.1.redhat-621084.jar:2.15.1.redhat-621084]
      	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) [spring-tx-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      	at org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:92) [camel-jpa-2.15.1.redhat-621084.jar:2.15.1.redhat-621084]
      

      This WARN message gets logged at each polling cycle and the only way of stopping it is to undeploy the app.

            toigaras@redhat.com tomohisa igarashi
            rhn-support-mputz Martin Weiler (Inactive)
            Tomas Turek Tomas Turek
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: