Quantcast

SpringTransactionManager - Participating in existing transactions is not supported

classic Classic list List threaded Threaded
5 messages Options
nvp152 nvp152
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

SpringTransactionManager - Participating in existing transactions is not supported

This post has NOT been accepted by the mailing list yet.
I wanted to use Spring's ChainedTransactionManager with Ignite's SpringTransactionManager as shown below but I get this exception. Why is that? Seems like doSetRollbackOnly isn't implemented......

org.springframework.transaction.UnexpectedRollbackException: Rollback exception, originated at (org.apache.ignite.transactions.spring.SpringTransactionManager@646c0a67) Participating in existing transactions is not supported - when 'isExistingTransaction' returns true, appropriate 'doSetRollbackOnly' behavior must be provided; nested exception is org.springframework.transaction.IllegalTransactionStateException: Participating in existing transactions is not supported - when 'isExistingTransaction' returns true, appropriate 'doSetRollbackOnly' behavior must be provided
        at org.springframework.data.transaction.ChainedTransactionManager.rollback(ChainedTransactionManager.java:206)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:539)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:285)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
        at com.sun.proxy.$Proxy33.save(Unknown Source)
        at com.pujol.demo.xa.core.service.impl.InternalScheduleServiceImpl.saveBoth(InternalScheduleServiceImpl.java:62)
......
.....
Caused by: org.springframework.transaction.IllegalTransactionStateException: Participating in existing transactions is not supported - when 'isExistingTransaction' returns true, appropriate 'doSetRollbackOnly' behavior must be provided
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.doSetRollbackOnly(AbstractPlatformTransactionManager.java:1224)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:856)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:826)
        at org.springframework.data.transaction.MultiTransactionStatus.rollback(MultiTransactionStatus.java:82)
        at org.springframework.data.transaction.ChainedTransactionManager.rollback(ChainedTransactionManager.java:189)
        ... 21 more

====================
This is my setup

    @Bean
    public SpringTransactionManager igniteTransactionManager() {
        SpringTransactionManager txMgr = new SpringTransactionManager();
        txMgr.setTransactionConcurrency(TransactionConcurrency.OPTIMISTIC);
        txMgr.setGridName(GRID_NAME);
        return txMgr;    
    }
   
    @Bean
    @Primary
    public PlatformTransactionManager comboTransactionManager() {

        HibernateTransactionManager txMgrA = new HibernateTransactionManager(_sessionFactoryA);
        HibernateTransactionManager txMgrB = new HibernateTransactionManager(_sessionFactoryB);
       
        SpringTransactionManager txMgrC = igniteTransactionManager();        
        ChainedTransactionManager txMgr = new ChainedTransactionManager(txMgrA, txMgrB, txMgrC);
       
        return txMgr;
    }
nvp152 nvp152
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SpringTransactionManager - Participating in existing transactions is not supported

I tried patching SpringTransactionManager and implement doSetRollbackOnly() and it works for me.
Does this look right for a doSetRollbackOnly() impl? If so it probably would make sense to contribute to the main code base:

....

    @Override protected void doSetRollbackOnly(DefaultTransactionStatus status) {
        IgniteTransactionObject txObj = (IgniteTransactionObject)status.getTransaction();
        txObj.getTransactionHolder().setRollbackOnly();
    }

...
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SpringTransactionManager - Participating in existing transactions is not supported

Hi,

Can you show the source of ChainedTransactionManager? What is the use case?

As for you fix, we would be happy to review it and accept the contribution. Can you create a ticket with fll description and a pull request?

-Val
Sumanta Ghosh Sumanta Ghosh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SpringTransactionManager - Participating in existing transactions is not supported

This post has NOT been accepted by the mailing list yet.
Hi,
Is there any plan to include this as a fix of SpringTransactionManager; we have the exact same situation - so was wondering in case patch is there, we do not have to override SpringTransactionManager class.
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SpringTransactionManager - Participating in existing transactions is not supported

Hi,

Please properly subscribe to the mailing list so that the community can receive email notifications for your messages. To subscribe, send empty email to user-subscribe@ignite.apache.org and follow simple instructions in the reply.

Sumanta Ghosh wrote
Is there any plan to include this as a fix of SpringTransactionManager; we have the exact same situation - so was wondering in case patch is there, we do not have to override SpringTransactionManager class.
I don't think it was done. Do you want to contribute?

-Val
Loading...