camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Problem with Camel Jpa Component and Container Managed Transaction
Date Fri, 22 Jun 2012 10:05:50 GMT
Hi

You run this in OSGi Blueprint.

Just to be sure, have you got this running outside osgi in lets say a
regular junit test case or something.
This helps track down knowing its related to your runtime platform.



On Fri, Jun 22, 2012 at 8:56 AM, Sriraman Gopalan <sreeraaman@gmail.com> wrote:
> Hi Claus,
>
> Thanks for the quick reply.
>
> Please find below the complete log from the point the consumer poll is
> started till it is completed:
>
> 2012-06-22 12:11:20,178 | TRACE | .CustomerAccount | ScheduledPollConsumer
> | 84 - org.apache.camel.camel-core - 2.9.2 | Scheduled task started on:
> Endpoint[jpa://samples.CustomerAccount?consumeDelete=false?consumer.delay=10000?persistenceUnit=pdsprint1&consumer.namedQuery=selectAllCustomerAccounts]
> 2012-06-22 12:11:20,179 | TRACE | .CustomerAccount | ScheduledPollConsumer
> | 84 - org.apache.camel.camel-core - 2.9.2 | Starting to poll:
> Endpoint[jpa://samples.CustomerAccount?consumeDelete=false?consumer.delay=10000?persistenceUnit=pdsprint1&consumer.namedQuery=selectAllCustomerAccounts]
> 2012-06-22 12:11:20,179 | DEBUG | .CustomerAccount | JpaTransactionManager
> | 77 - org.springframework.transaction - 3.0.7.RELEASE | Creating new
> transaction with name [null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
> 2012-06-22 12:11:20,180 | DEBUG | .CustomerAccount | JpaTransactionManager
> | 77 - org.springframework.transaction - 3.0.7.RELEASE | Opened new
> EntityManager
> [org.apache.aries.jpa.container.impl.EntityManagerWrapper@3192caa9] for JPA
> transaction
> 2012-06-22 12:11:20,180 | DEBUG | .CustomerAccount | JpaTransactionManager
> | 77 - org.springframework.transaction - 3.0.7.RELEASE | Could not rollback
> EntityManager after failed transaction begin
> <openjpa-2.1.1-r422266:1148538 nonfatal user error>
> org.apache.openjpa.persistence.InvalidStateException: You cannot access the
> EntityTransaction when using managed transactions.
>        at
> org.apache.openjpa.persistence.EntityManagerImpl.getTransaction(EntityManagerImpl.java:551)[176:org.apache.openjpa:2.1.1]
>        at
> org.apache.openjpa.persistence.EntityManagerImpl.getTransaction(EntityManagerImpl.java:101)[176:org.apache.openjpa:2.1.1]
>        at
> org.apache.aries.jpa.container.impl.EntityManagerWrapper.getTransaction(EntityManagerWrapper.java:153)[54:org.apache.aries.jpa.container:0.3.0]
>        at
> org.springframework.orm.jpa.JpaTransactionManager.closeEntityManagerAfterFailedBegin(JpaTransactionManager.java:412)[170:org.springframework.orm:3.0.7.RELEASE]
>        at
> org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:381)[170:org.springframework.orm:3.0.7.RELEASE]
>        at
> org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)[77:org.springframework.transaction:3.0.7.RELEASE]
>        at
> org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)[77:org.springframework.transaction:3.0.7.RELEASE]
>        at
> org.apache.camel.component.jpa.JpaTemplateTransactionStrategy.execute(JpaTemplateTransactionStrategy.java:78)[177:org.apache.camel.camel-jpa:2.9.2]
>        at
> org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:81)[177:org.apache.camel.camel-jpa:2.9.2]
>        at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:138)[84:org.apache.camel.camel-core:2.9.2]
>        at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:90)[84:org.apache.camel.camel-core:2.9.2]
>        at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_29]
>        at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)[:1.6.0_29]
>        at
> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)[:1.6.0_29]
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)[:1.6.0_29]
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)[:1.6.0_29]
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)[:1.6.0_29]
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_29]
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_29]
>        at java.lang.Thread.run(Thread.java:662)[:1.6.0_29]
> 2012-06-22 12:11:20,180 | DEBUG | .CustomerAccount |
> EntityManagerFactoryUtils        | 170 - org.springframework.orm -
> 3.0.7.RELEASE | Closing JPA EntityManager
> 2012-06-22 12:11:20,183 | WARN  | .CustomerAccount |
> faultPollingConsumerPollStrategy | 84 - org.apache.camel.camel-core - 2.9.2
> | Consumer
> Consumer[jpa://samples.CustomerAccount?consumeDelete=false?consumer.delay=10000?persistenceUnit=pdsprint1&consumer.namedQuery=selectAllCustomerAccounts]
> could not poll endpoint:
> Endpoint[jpa://samples.CustomerAccount?consumeDelete=false?consumer.delay=10000?persistenceUnit=pdsprint1&consumer.namedQuery=selectAllCustomerAccounts]
> caused by: Could not open JPA EntityManager for transaction; nested
> exception is <openjpa-2.1.1-r422266:1148538 nonfatal user error>
> org.apache.openjpa.persistence.InvalidStateException: You cannot access the
> EntityTransaction when using managed transactions.
> org.springframework.transaction.CannotCreateTransactionException: Could not
> open JPA EntityManager for transaction; nested exception is
> <openjpa-2.1.1-r422266:1148538 nonfatal user error>
> org.apache.openjpa.persistence.InvalidStateException: You cannot access the
> EntityTransaction when using managed transactions.
>        at
> org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:382)[170:org.springframework.orm:3.0.7.RELEASE]
>        at
> org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)[77:org.springframework.transaction:3.0.7.RELEASE]
>        at
> org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)[77:org.springframework.transaction:3.0.7.RELEASE]
>        at
> org.apache.camel.component.jpa.JpaTemplateTransactionStrategy.execute(JpaTemplateTransactionStrategy.java:78)[177:org.apache.camel.camel-jpa:2.9.2]
>        at
> org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:81)[177:org.apache.camel.camel-jpa:2.9.2]
>        at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:138)[84:org.apache.camel.camel-core:2.9.2]
>        at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:90)[84:org.apache.camel.camel-core:2.9.2]
>        at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_29]
>        at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)[:1.6.0_29]
>        at
> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)[:1.6.0_29]
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)[:1.6.0_29]
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)[:1.6.0_29]
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)[:1.6.0_29]
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_29]
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_29]
>        at java.lang.Thread.run(Thread.java:662)[:1.6.0_29]
> Caused by: <openjpa-2.1.1-r422266:1148538 nonfatal user error>
> org.apache.openjpa.persistence.InvalidStateException: You cannot access the
> EntityTransaction when using managed transactions.
>        at
> org.apache.openjpa.persistence.EntityManagerImpl.getTransaction(EntityManagerImpl.java:551)[176:org.apache.openjpa:2.1.1]
>        at
> org.apache.openjpa.persistence.EntityManagerImpl.getTransaction(EntityManagerImpl.java:101)[176:org.apache.openjpa:2.1.1]
>        at
> org.apache.aries.jpa.container.impl.EntityManagerWrapper.getTransaction(EntityManagerWrapper.java:153)[54:org.apache.aries.jpa.container:0.3.0]
>        at
> org.springframework.orm.jpa.DefaultJpaDialect.beginTransaction(DefaultJpaDialect.java:70)[170:org.springframework.orm:3.0.7.RELEASE]
>        at
> org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:332)[170:org.springframework.orm:3.0.7.RELEASE]
>        ... 15 more
> 2012-06-22 12:11:20,185 | TRACE | .CustomerAccount | ScheduledPollConsumer
> | 84 - org.apache.camel.camel-core - 2.9.2 | Scheduled task completed on:
> Endpoint[jpa://samples.CustomerAccount?consumeDelete=false?consumer.delay=10000?persistenceUnit=pdsprint1&consumer.namedQuery=selectAllCustomerAccounts]
>
>
> Also, please find below the list of features installed in my system along
> with the versions.
>
> karaf@root> features:list | grep -w installed
> [installed  ] [3.0.7.RELEASE  ] spring
> karaf-2.2.7
> [installed  ] [1.2.1          ] spring-dm
> karaf-2.2.7
> [installed  ] [3.0.7.RELEASE  ] spring-jdbc
> karaf-2.2.7
> [installed  ] [3.0.7.RELEASE  ] spring-jms
> karaf-2.2.7
> [installed  ] [3.0.7.RELEASE  ] spring-orm
> karaf-2.2.7
> [installed  ] [3.0.7.RELEASE  ] spring-tx
> karaf-2.2.7
> [installed  ] [3.0.7.RELEASE  ] spring-web
> karaf-2.2.7
> [installed  ] [2.2.7          ] config
> karaf-2.2.7
> [installed  ] [7.5.4.v20111024] jetty
> karaf-2.2.7
> [installed  ] [2.2.7          ] http
> karaf-2.2.7
> [installed  ] [2.2.7          ] kar
> karaf-2.2.7
> [installed  ] [2.2.7          ] webconsole-base
> karaf-2.2.7
> [installed  ] [2.2.7          ] webconsole
> karaf-2.2.7
> [installed  ] [2.2.7          ] ssh
> karaf-2.2.7
> [installed  ] [2.2.7          ] management
> karaf-2.2.7
> [installed  ] [0.3            ] transaction
> karaf-enterprise-2.2.7 OSGi Transaction Manager
> [installed  ] [0.3            ] jpa
> karaf-enterprise-2.2.7 OSGi Persistence Container
> [installed  ] [0.3            ] jndi
> karaf-enterprise-2.2.7 OSGi Service Registry JNDI access
> [installed  ] [1.9.0          ] xml-specs-api
> camel-2.9.2
> [installed  ] [2.9.2          ] camel-core
> camel-2.9.2
> [installed  ] [2.9.2          ] camel-spring
> camel-2.9.2
> [installed  ] [2.9.2          ] camel-blueprint
> camel-2.9.2
> [installed  ] [2.9.2          ] camel-cxf
> camel-2.9.2
> [installed  ] [2.9.2          ] camel-http4
> camel-2.9.2
> [installed  ] [2.9.2          ] camel-jackson
> camel-2.9.2
> [installed  ] [2.9.2          ] camel-jpa
> camel-2.9.2
> [installed  ] [2.9.2          ] camel-mybatis
> camel-2.9.2
> [installed  ] [2.9.2          ] camel-xstream
> camel-2.9.2
> [installed  ] [2.5.2          ] cxf-specs
> cxf-2.5.2
> [installed  ] [2.5.2          ] cxf-jaxb
> cxf-2.5.2
> [installed  ] [2.5.2          ] cxf-abdera
> cxf-2.5.2
> [installed  ] [2.5.1_1        ] opensaml
> cxf-2.5.2
> [installed  ] [1.6.4          ] wss4j
> cxf-2.5.2
> [installed  ] [2.5.2          ] cxf-saaj-impl
> cxf-2.5.2
> [installed  ] [2.5.2          ] cxf-war-java5
> cxf-2.5.2
> [installed  ] [2.5.2          ] cxf
> cxf-2.5.2
>
> best regards
> Sriraman.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problem-with-Camel-Jpa-Component-and-Container-Managed-Transaction-tp5714815p5714893.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message