camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-9608) camel-jpa consumer fails to poll after transaction timeout
Date Wed, 17 Feb 2016 08:15:18 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-9608?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen updated CAMEL-9608:
-------------------------------
    Affects Version/s: 2.15.5

> camel-jpa consumer fails to poll after transaction timeout
> ----------------------------------------------------------
>
>                 Key: CAMEL-9608
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9608
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.15.5, 2.16.2
>            Reporter: Tomohisa Igarashi
>             Fix For: 2.15.6, 2.16.3, 2.17.0
>
>
> On JBoss EAP environment, camel-jpa consumer receives following right after transaction
timeout
> {noformat}
> 15:08:36,356 WARN  [org.apache.camel.component.jpa.JpaConsumer] (Camel ({urnswitchyard-quickstartcamel-jpa-binding0.1.0}camel-jpa-retrieve-binding)
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=500&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=500&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_65]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_65]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.8.0_65]
> 	at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_65]
> 	at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:366)
[spring-orm-3.2.12.RELEASE.jar:3.2.12.RELEASE]
> 	at com.sun.proxy.$Proxy45.remove(Unknown Source)
> 	at org.apache.camel.component.jpa.JpaConsumer$5.deleteObject(JpaConsumer.java:456) [camel-jpa-2.15.2.jar:2.15.2]
> ..... (snip) .....
> Caused by: org.hibernate.HibernateException: Transaction was rolled back in a different
thread!
> 	at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorTrackingImpl.processAnyDelayedAfterCompletion(SynchronizationCallbackCoordinatorTrackingImpl.java:105)
[hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
> 	at org.hibernate.internal.SessionImpl.delayedAfterCompletion(SessionImpl.java:636) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
> 	at org.hibernate.internal.SessionImpl.checkTransactionSynchStatus(SessionImpl.java:2070)
[hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
> 	at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:916) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
> 	at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:855) [hibernate-core-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
> 	at org.hibernate.ejb.AbstractEntityManagerImpl.remove(AbstractEntityManagerImpl.java:905)
[hibernate-entitymanager-4.2.21.Final-redhat-1.jar:4.2.21.Final-redhat-1]
> 	... 20 more
> {noformat}
> After this, camel-jpa is no longer able to handle its polling due to staled connection
> {noformat}
> 15:08:36,860 WARN  [org.apache.camel.component.jpa.JpaConsumer] (Camel ({urnswitchyard-quickstartcamel-jpa-binding0.1.0}camel-jpa-retrieve-binding)
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=500&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=500&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.2.jar:2.15.2]
> 	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)
[spring-tx-3.2.12.RELEASE.jar:3.2.12.RELEASE]
> 	at org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:92) [camel-jpa-2.15.2.jar:2.15.2]
> ..... (snip) .....
> 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
> {noformat}
> According to the Java Persistence API 3.3.2 Transaction Rollback, the persistence context
could be in inconsistent state after transaction rollback, which is suggesting to renew the
EntityManager instance after transaction rollback. Actually I verified that if I renewed the
EntityManager instance after rollback then camel-jpa could continue to work after that. I'll
submit a pull request in a minute.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message