8 Replies Latest reply on Oct 22, 2008 10:56 AM by Brice Ruth

    JTA/WS-TX bridge, how to stop() when Tx not ACTIVE?

    Brice Ruth Novice

      Good morning,

      I am still working on getting JTA/WS-TX bridging to work in all conditions and one thing I found is that in my standard processing for rolling back transactions, I can't stop() the InboundBridge, because the suspend() call throws an IllegalStateException when the Tx is not in state ACTIVE (I believe the JTA Tx has been set to rollback only).

      Here's pseudo code for what I'm doing:


      1. Get a UserTransaction from UserTransactionFactory
      2. ut.begin()
      3. Get InboundBridge from TxBridgeManager
      4. ib.start()
      5. do work <- Exception thrown here
      6. ib.stop()
      7. ut.commit()


        This is all wrapped in a try/catch, if an exception escapes, then I call ib.stop() then ut.rollback(). This is where I'm getting into trouble. The ib.stop() call throws IllegalStateException and if I just catch & log that, and go ahead and call ut.rollback(), I still get a message in the log from the TransactionManager that the application manager didn't complete its transaction.

        So .. what exactly is supposed to happen in this scenario?

        Thanks,
        Brice

        p.s. JBoss 4.3 EAP + JBossTS 4.3 deployed as SAR


        • 1. Re: JTA/WS-TX bridge, how to stop() when Tx not ACTIVE?
          Jonathan Halliday Master

          stop() should work even on a rollback only tx. Can you post the stack trace please.

          • 3. Re: JTA/WS-TX bridge, how to stop() when Tx not ACTIVE?
            Brice Ruth Novice

            OK, the way that the code logs the exception is a little strange (because I'm trying to log the exception that caused the rollback, then an exception occurs during my processing ...). In any case, here's what's easily logged. I'll set a breakpoint and see if I can get a stacktrace from the exception that's thrown right at the point that stop() is invoked.

            java.lang.RuntimeException: Transaction not in state ACTIVE
             at com.example.lbpa.core.util.advice.WsTransactionalAttributeSourceAdvice.processException(WsTransactionalAttributeSourceAdvice.java:60)
             at com.example.lbpa.core.util.advice.WsTransactionalAttributeSourceAdvice.invoke(WsTransactionalAttributeSourceAdvice.java:39)
             at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
             at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)
             at com.example.lbpa.web.struts.ext.TransactionalActionServlet$$EnhancerByCGLIB$$598027d7.doSuperPost(<generated>)
             at com.example.lbpa.web.struts.ext.TransactionalActionServlet.doPost(TransactionalActionServlet.java:125)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at com.example.lbpa.web.filter.JsonWrapperFilter.doFilter(JsonWrapperFilter.java:90)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at com.example.lbpa.web.filter.XMLSerializerWorkerFilter.doFilter(XMLSerializerWorkerFilter.java:55)
             at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
             at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at com.example.lbpa.core.util.hibernate.OracleTraceFilter.doFilter(OracleTraceFilter.java:62)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at com.example.lbpa.web.filter.RetrieveWorkerFilter.doFilter(RetrieveWorkerFilter.java:78)
             at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
             at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:182)
             at com.example.internalsso.exampleSecurityFilter.doFilter(exampleSecurityFilter.java:172)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at com.example.lbpa.web.util.CacheControlFilter.doFilter(CacheControlFilter.java:58)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at com.example.lbpa.web.util.AjaxNoCacheFilter.doFilter(AjaxNoCacheFilter.java:54)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
             at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
             at java.lang.Thread.run(Thread.java:595)
            Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Testing rollback
             at com.example.lbpa.core.util.advice.WsTransactionalAttributeSourceAdvice.processException(WsTransactionalAttributeSourceAdvice.java:46)
             ... 51 more
            Caused by: java.lang.RuntimeException: Testing rollback
             at com.example.lbpa.web.struts.ext.TransactionalActionServlet.doSuperPost(TransactionalActionServlet.java:148)
             at com.example.lbpa.web.struts.ext.TransactionalActionServlet$$FastClassByCGLIB$$d030a712.invoke(<generated>)
             at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
             at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:696)
             at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
             at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
             at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
             at com.example.lbpa.core.util.advice.WsTransactionalAttributeSourceAdvice.invoke(WsTransactionalAttributeSourceAdvice.java:34)
             ... 50 more
            10:42:07,538 ERROR [CachedConnectionValve] Failed to rollback
            java.lang.IllegalStateException
             at com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.TransactionImple.rollbackAndDisassociate(TransactionImple.java:335)
             at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.rollback(BaseTransaction.java:163)
             at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.rollback(BaseTransactionManagerDelegate.java:126)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.checkTransactionComplete(CachedConnectionValve.java:240)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:167)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
             at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
             at java.lang.Thread.run(Thread.java:595)


            • 4. Re: JTA/WS-TX bridge, how to stop() when Tx not ACTIVE?
              Brice Ruth Novice

              You may want to ignore this trace, I think my code betw. the workspace and JBoss is out of sync. I should have a new trace momentarily ...

              • 5. Re: JTA/WS-TX bridge, how to stop() when Tx not ACTIVE?
                Brice Ruth Novice

                Here's the proper stack trace, taken immediately after the stop().

                13:09:57,026 ERROR [STDERR] java.lang.IllegalStateException: Transaction not in state ACTIVE
                13:09:57,026 ERROR [STDERR] at org.jboss.txbridge.InboundBridge.getTransaction(InboundBridge.java:106)
                13:09:57,026 ERROR [STDERR] at org.jboss.txbridge.InboundBridge.stop(InboundBridge.java:83)
                13:09:57,026 ERROR [STDERR] at com.example.lbpa.core.util.advice.WsTransactionalAttributeSourceAdvice.processException(WsTransactionalAttributeSourceAdvice.java:51)
                13:09:57,026 ERROR [STDERR] at com.example.lbpa.core.util.advice.WsTransactionalAttributeSourceAdvice.invoke(WsTransactionalAttributeSourceAdvice.java:39)
                13:09:57,026 ERROR [STDERR] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
                13:09:57,026 ERROR [STDERR] at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)
                13:09:57,026 ERROR [STDERR] at com.example.lbpa.web.struts.ext.TransactionalActionServlet$$EnhancerByCGLIB$$845837e3.doSuperPost(<generated>)
                13:09:57,026 ERROR [STDERR] at com.example.lbpa.web.struts.ext.TransactionalActionServlet.doPost(TransactionalActionServlet.java:125)
                13:09:57,026 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
                13:09:57,026 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                13:09:57,026 ERROR [STDERR] at com.example.lbpa.web.filter.JsonWrapperFilter.doFilter(JsonWrapperFilter.java:90)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                13:09:57,026 ERROR [STDERR] at com.example.lbpa.web.filter.XMLSerializerWorkerFilter.doFilter(XMLSerializerWorkerFilter.java:55)
                13:09:57,026 ERROR [STDERR] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
                13:09:57,026 ERROR [STDERR] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                13:09:57,026 ERROR [STDERR] at com.example.lbpa.core.util.hibernate.OracleTraceFilter.doFilter(OracleTraceFilter.java:62)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                13:09:57,026 ERROR [STDERR] at com.example.lbpa.web.filter.RetrieveWorkerFilter.doFilter(RetrieveWorkerFilter.java:78)
                13:09:57,026 ERROR [STDERR] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
                13:09:57,026 ERROR [STDERR] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                13:09:57,026 ERROR [STDERR] at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:182)
                13:09:57,026 ERROR [STDERR] at com.example.internalsso.exampleSecurityFilter.doFilter(exampleSecurityFilter.java:172)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                13:09:57,026 ERROR [STDERR] at com.example.lbpa.web.util.CacheControlFilter.doFilter(CacheControlFilter.java:58)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                13:09:57,026 ERROR [STDERR] at com.example.lbpa.web.util.AjaxNoCacheFilter.doFilter(AjaxNoCacheFilter.java:54)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                13:09:57,026 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                13:09:57,042 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                13:09:57,042 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                13:09:57,042 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                13:09:57,042 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                13:09:57,042 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                13:09:57,042 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                13:09:57,042 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                13:09:57,042 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                13:09:57,042 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                13:09:57,042 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                13:09:57,042 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                13:09:57,042 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                13:09:57,042 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                13:09:57,042 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                13:09:57,042 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                13:09:57,042 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
                


                • 6. Re: JTA/WS-TX bridge, how to stop() when Tx not ACTIVE?
                  Jonathan Halliday Master

                  That's a bug in the bridge - the case statement in getTransaction() is not sophisticated enough. Does patching it to treat Status.STATUS_MARKED_ROLLBACK the same as ACTIVE fix your problem?

                  • 7. Re: JTA/WS-TX bridge, how to stop() when Tx not ACTIVE?
                    Brice Ruth Novice

                    I'll make this change and let you know! Thanks!!

                    • 8. Re: JTA/WS-TX bridge, how to stop() when Tx not ACTIVE?
                      Brice Ruth Novice

                      That seemed to do it. Now the app server isn't whining at me anymore ;-) Thanks a bunch!!