JpaConsumer fails to poll after transaction timeout in Fuse 6.2.1 on EAP

Solution In Progress - Updated -

Issue

We are using Quartz to trigger a flow which does some extensive DB processing. Some DB operations can exceed the default transaction timeout. We could simply increase the default transaction timeout, thus affecting all other applications running on the application server, but still we have no guarantee that the chosen timeout is long enough.

Once the transaction reaper aborts the long running transaction due to the configured transaction timeout, the transaction of this poll is rolled back. This is the expected behavior. However, the next scheduled runs of the JpaConsumer result in the following WARN message:

08:07:29,495 WARN  [org.apache.camel.component.jpa.JpaConsumer] (Camel (camel-1) thread #0 - 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] failed polling endpoint: Endpoint[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: Logical connection is closed]: javax.persistence.PersistenceException: org.hibernate.HibernateException: Logical connection is closed
    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.QueryImpl.getResultList(QueryImpl.java:277) [hibernate-entitymanager-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.apache.camel.component.jpa.JpaConsumer$1.doInTransaction(JpaConsumer.java:104) [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]
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.15.1.redhat-621084.jar:2.15.1.redhat-621084]
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.15.1.redhat-621084.jar:2.15.1.redhat-621084]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_45]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [rt.jar:1.7.0_45]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [rt.jar:1.7.0_45]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [rt.jar:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
Caused by: org.hibernate.HibernateException: Logical connection is closed
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:150) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:56) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:159) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:183) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:157) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1881) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1858) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1838) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.loader.Loader.doQuery(Loader.java:906) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:348) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.loader.Loader.doList(Loader.java:2550) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.loader.Loader.doList(Loader.java:2536) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2366) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.loader.Loader.list(Loader.java:2361) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:495) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:357) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:198) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1230) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:268) [hibernate-entitymanager-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
    ... 12 more

The only workaround at the moment is to undeploy the application in case of a transaction timeout.

Environment

  • Red Hat JBoss Fuse (on EAP)
    • 6.2.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.