You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Allan Cheong Tyng Huei (JIRA)" <ji...@apache.org> on 2016/05/07 13:11:12 UTC

[jira] [Comment Edited] (ARIES-1548) JTA container managed transaction rollback not working for jaxrs endpoint

    [ https://issues.apache.org/jira/browse/ARIES-1548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15275224#comment-15275224 ] 

Allan Cheong Tyng Huei edited comment on ARIES-1548 at 5/7/16 1:10 PM:
-----------------------------------------------------------------------

I think you are right. The problem can be reproduced with just the jaxrs endpoint. I also reviewed and run another a test case for another route (file -> jpa) and the roll back didn't happen. The test case is invalid.

This is my datasource:
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="${database.driver.classname}" />
    <property name="url" value="${database.url}" />
    <property name="username" value="${database.username}" />
    <property name="password" value="${database.password}" />
</bean>

<service ref="dataSource" interface="javax.sql.DataSource">
    <service-properties>
        <entry key="osgi.jndi.service.name" value="jdbc/ds" />
    </service-properties>
</service>

I'm looking at the link you provided. Will set to use pax-jdbc and see if it works.


was (Author: allancth):
I think you are right. The problem can be reproduced with just the jaxrs endpoint. I also reviewed and run another a test case for another route (file -> jpa) and the roll back didn't happen. The test case is invalid.

This is my datasource:
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="${database.driver.classname}"/>
    <property name="url" value="${database.url}"/>
    <property name="username" value="${database.username}" />
    <property name="password" value="${database.password}" />
</bean>

<service ref="dataSource" interface="javax.sql.DataSource">
    <service-properties>
        <entry key="osgi.jndi.service.name" value="jdbc/ds" />
    </service-properties>
</service>

I'm looking at the link you provided. Will set to use pax-jdbc and see if it works.

> JTA container managed transaction rollback not working for jaxrs endpoint
> -------------------------------------------------------------------------
>
>                 Key: ARIES-1548
>                 URL: https://issues.apache.org/jira/browse/ARIES-1548
>             Project: Aries
>          Issue Type: Bug
>          Components: Transaction
>         Environment: JBoss Fuse 6.2.1, JDK7
> Testing environment Windows 7 x64
>            Reporter: Allan Cheong Tyng Huei
>            Assignee: Christian Schneider
>
> Rest Endpoint
> <jaxrs:server id="jaxrs" address="http://127.0.0.1:8080/jaxrs">
>     <jaxrs:serviceBeans>
>         <ref component-id="service1" />
>         ...
>         ...
>         <ref component-id="serviceX" />
>     </jaxrs:serviceBeans>
>     <jaxrs:providers>
>         <ref component-id="runtimeExceptionMapper" />
>     </jaxrs:providers>
> </jaxrs:server>
> Route
> <route id="secureBridgeRoute">
>     <from uri="jetty:https://0.0.0.0:443/jaxrs?sslContextParametersRef=sslContextParameters&amp;matchOnUriPrefix=true&amp;minThreads=8&amp;maxThreads=16" />
>     <transacted ref="JTA_TRANSACTION" />
>     <to uri="jetty:http://127.0.0.1:8080/jaxrs?bridgeEndpoint=true&amp;throwExceptionOnFailure=true" />
> </route>
> DAO
> <bean id="dao1" class="com.example.Dao1" activation="eager">
>     <jpa:context unitname="PU" property="entityManager" type="TRANSACTION" />
> </bean>
> Service bean
> <bean id="service1" class="com.example.Service1" activation="eager">
>     <property name="dao1" ref="dao1" />
>     <property name="dao2" ref="dao2" />
>     <tx:transaction method="*" value="Required" />
> </bean>
> Service bean method pseudocode
> public void create(entity1, entity2) {
>     dao1.persist(entity1);
>     dao2.persist(entity2);
> }
> When dao2 persist failed, the transaction did not get rolled back. Entity1 is inserted into the DB.
> Additional information
> 1) TransactionManager definition
> <reference id="platformTransactionManager" interface="org.springframework.transaction.PlatformTransactionManager" />
> <bean id="JTA_TRANSACTION" class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>     <property name="transactionManager" ref="platformTransactionManager" />
>     <property name="propagationBehaviorName" value="PROPAGATION_REQUIRED" />
> </bean>
> 2) My persistent unit is of type JTA and hibernate as the provider.
> 3) I have an ExceptionMapper, which when I look into it, the stacktrace shows the transaction indeed is marked for rollback.
> 4) The service beans are not separated to another bundle.
> 5) Hibernate autocommit is NOT true.



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