Aug 8th, 2011, 02:26 AM
java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not
[LEFT]I am facing an issue with spring transaction manager.The issue goes like this
I have an application from where I launch a spring job(everything juns in the same jvm).My application has its own database tables to be populated.
My application is using its own org.springframework.jdbc.datasource.DataSourceTran sactionManager .Spring batch uses its own org.springframework.jdbc.datasource.DataSourceTran sactionManager. The commit issued from my application gives the following error..
java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active
at org.springframework.transaction.support.Transactio nSynchronizationManager.clearSynchronization(Trans actionSynchronizationManager.java:314)
at org.springframework.transaction.support.Transactio nSynchronizationManager.clear(TransactionSynchroni zationManager.java:449)
at org.springframework.transaction.support.AbstractPl atformTransactionManager.cleanupAfterCompletion(Ab stractPlatformTransactionManager.java:1008)
So ideally in this scenario where I have 2 similar transaction managers what should I do inorder to avoid the above error. I tried setting the TransactionDefinition to PROPAGATION_NESTED and TransactionSynchronization to SYNCHRONIZATION_NEVER in my application. After this the application started committing the appln specific tables but the spring batch specific tables entries where not getting committed properly..I tried setting the same transaction attributes in the sping batch job xml also..but then there was commit problem with my application code.
Could any one please help on this issue.
What should be the right way to execute these kind of applications where I have multiple/identical datasource transaction managers.