camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pew, Benjamin L" <...@bcm.edu>
Subject No transaction active for JpaEndpoint
Date Wed, 12 Jun 2013 15:59:20 GMT
I am new to Camel. I have spent the better part of two days searching
through the web and in the Camel documentation for something to help me,
but with no luck.

Camel 2.11
Application runs under JBoss AS 7.1
We do not use Spring
CamelContext is setup using Camel CDI

I am trying to setup a JPA consumer endpoint.
I have set an EntityManagerFactory and JtaTransactionManager on the
JpaComponent.

The following route works:

from(
        this.getComponentName()
            + ":edu.wustl.catissuecore.domain.Specimen?persistenceUnit="
            + this.getInstance().getPersistenceUnit()
            + 
"&consumeDelete=false&consumer.namedQuery=newSpecimen&consumer.delay=60000"
)
        .removeHeaders("Camel*")
        .setHeader("instance", this.constant(this.getInstance().name()))
        .to("sjms:topic:newSpecimenTopic?transacted=true");

My second route is following (in a class extending SpringRouteBuilder):

from(
        this.getComponentName()
            + 
":edu.bcm.dldcc.big.utility.entity.NewParticipantLog?persistenceUnit="
            + this.getInstance().getPersistenceUnit()
            + "&consumer.delay=60000")
        .removeHeaders("Camel*").transacted()
        .setHeader("instance", this.constant(this.getInstance().name()))
        .to("sjms:topic:newParticipantTopic?transacted=true");


This fails, with the following error:
Caused by: javax.persistence.TransactionRequiredException: no transaction
is in progress
	at 
org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl
.java:976) [hibernate-entitymanager-4.1.2.Final.jar:4.1.2.Final]
	at sun.reflect.GeneratedMethodAccessor829.invoke(Unknown Source)
[:1.6.0_45]
	at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
l.java:25) [classes.jar:1.6.0_45]
	at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_45]
	at 
org.springframework.orm.jpa.JpaTemplate$CloseSuppressingInvocationHandler.i
nvoke(JpaTemplate.java:429) [spring-orm-3.1.4.RELEASE.jar:3.1.4.RELEASE]
	at com.sun.proxy.$Proxy219.flush(Unknown Source)
	at 
org.apache.camel.component.jpa.JpaConsumer$1.doInJpa(JpaConsumer.java:117)
[camel-jpa-2.11.0.jar:2.11.0]
	at 
org.apache.camel.component.jpa.JpaTemplateTransactionStrategy$1$1.doInJpa(J
paTemplateTransactionStrategy.java:82) [camel-jpa-2.11.0.jar:2.11.0]
	at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:187)
[spring-orm-3.1.4.RELEASE.jar:3.1.4.RELEASE]
	... 16 more

I have not been able to find any explanation of how to get the
JpaComponent to operate within a transaction.

Thanks.




Mime
View raw message