java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active

Spring JIRA | Jacqueline Stark | 8 years ago
  1. 0

    Our project is using Spring-2.0.7 and Spring-ldap-1.2.1. We have a HibernateTransactionManager on an outer service, calling an inner service, which has wrapped an LDAP ContextSourceTransactionManager. If a transaction is attempted when LDAP isn't running, an exception occurs in Spring java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active at org.springframework.transaction.support.TransactionSynchronizationManager.clearSynchronization(TransactionSynchronizationManager.java:274) at org.springframework.transaction.support.TransactionSynchronizationManager.clear(TransactionSynchronizationManager.java:412) at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:916) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:785) at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:730) This then stops any future Hibernate transactions. I found an issue against Spring core, http://jira.springframework.org/browse/SPR-3438 , which I think is the same problem. This issue has been fixed in the extensions of AbstractPlatformTransactionManager in Spring core (eg HibernateTransactionManager, DataSourceTransactionManager). The issue is resolved by catching Exception in the various implementations of doBegin(), and rethrowing a CannotCreateTransactionException, which is caught by AbstractPlatformTransactionManager.getTransaction(), which in turn resumes the outer transaction. Should AbstractCompensatingTransactionManagerDelegate.doBegin() be doing the same? In other words, should the fix applied to Spring core for this issue also be applied to spring-ldap? To reproduce, the same test code in http://jira.springframework.org/browse/SPR-3438 can be used, but with the txMgrInner being a ContextSourceTransactionManager.

    Spring JIRA | 8 years ago | Jacqueline Stark
    java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    Our project is using Spring-2.0.7 and Spring-ldap-1.2.1. We have a HibernateTransactionManager on an outer service, calling an inner service, which has wrapped an LDAP ContextSourceTransactionManager. If a transaction is attempted when LDAP isn't running, an exception occurs in Spring java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active at org.springframework.transaction.support.TransactionSynchronizationManager.clearSynchronization(TransactionSynchronizationManager.java:274) at org.springframework.transaction.support.TransactionSynchronizationManager.clear(TransactionSynchronizationManager.java:412) at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:916) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:785) at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:730) This then stops any future Hibernate transactions. I found an issue against Spring core, http://jira.springframework.org/browse/SPR-3438 , which I think is the same problem. This issue has been fixed in the extensions of AbstractPlatformTransactionManager in Spring core (eg HibernateTransactionManager, DataSourceTransactionManager). The issue is resolved by catching Exception in the various implementations of doBegin(), and rethrowing a CannotCreateTransactionException, which is caught by AbstractPlatformTransactionManager.getTransaction(), which in turn resumes the outer transaction. Should AbstractCompensatingTransactionManagerDelegate.doBegin() be doing the same? In other words, should the fix applied to Spring core for this issue also be applied to spring-ldap? To reproduce, the same test code in http://jira.springframework.org/browse/SPR-3438 can be used, but with the txMgrInner being a ContextSourceTransactionManager.

    Spring JIRA | 8 years ago | Jacqueline Stark
    java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active
  4. 0

    If i try to comment a blog Post in 1.1.1 I recive: java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active at org.springframework.transaction.support.TransactionSynchronizationManager.clearSynchronization(TransactionSynchronizationManager.java:230) at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:507) at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:392) at com.atlassian.confluence.util.XWorkTransactionInterceptor.onThrowable(XWorkTransactionInterceptor.java:201) at com.atlassian.confluence.util.XWorkTransactionInterceptor.intercept(XWorkTransactionInterceptor.java:140) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:163) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:34) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:163) at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:115) at com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDispatcher.java:278) at com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:248) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:145) at com.atlassian.confluence.util.profiling.ProfilingPageFilter.parsePage(ProfilingPageFilter.java:146) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:61)

    Atlassian JIRA | 1 decade ago | Lorenz Barth
    java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      Cannot deactivate transaction synchronization - not active

      at org.springframework.transaction.support.TransactionSynchronizationManager.clearSynchronization()
    2. Spring Tx
      AbstractPlatformTransactionManager.rollback
      1. org.springframework.transaction.support.TransactionSynchronizationManager.clearSynchronization(TransactionSynchronizationManager.java:274)
      2. org.springframework.transaction.support.TransactionSynchronizationManager.clear(TransactionSynchronizationManager.java:412)
      3. org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:916)
      4. org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:785)
      5. org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:730)
      5 frames