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 02:07:12 UTC

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

Allan Cheong Tyng Huei created ARIES-1548:
---------------------------------------------

             Summary: 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


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)