6 Replies Latest reply on May 29, 2009 5:03 PM by shanwad

    java.lang.IllegalStateException:The transaction is not active!

      Application is based on Seam2.0, JSF1.2,Trinidad 1.2.7,Facelet and JBoss EAP 4.3.0

      Whenever user perform the operation on DB, if the operation takes more than 10 minutes and throws the ApplicationException,
      We get the following error:
      -----------------------------------------------------------------------------------------------------------------------------------
      java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] The transaction is not active!
           at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.rollbackAndDisassociate(TransactionImple.java:1490)
           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.tm.usertx.client.ServerVMClientUserTransaction.rollback(ServerVMClientUserTransaction.java:148)
           at org.jboss.seam.transaction.UTTransaction.rollback(UTTransaction.java:66)
           at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:597)
           at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:330)
           at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:231)
           at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:182)
           at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:238)
           at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:195)
           at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:138)
           at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
           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.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           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:182)
           at com.avaya.security.iam.tomcat.HTTPAuthInterceptor.invoke(HTTPAuthInterceptor.java:995)
           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.authenticator.SingleSignOn.invoke(SingleSignOn.java:420)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
           at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
           at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:381)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
           at java.lang.Thread.run(Thread.java:619)
      -----------------------------------------------------------------------------------------------------------------------------------
      Code is as follows:

      Seam Managed Bean :

      @Name("beanName")
      @Scope(ScopeType.CONVERSATION)
      public class Bean
      {
      // Action which is associated with button in xhtml
      @End(beforeRedirect = true)
      public String createDB() {
                 try{
                    //calls method from EJB3.0 stateless bean where transactions are  bean managed Transactions.
                    status = XLocal.performDBOperation(DTOObject);
                  }catch(ApplicationException ae)
                   {
                    Set FacesMessage for Error;
                      return null;
                    }
                    catch(Exception e)
                     {
                       Set FacesMessage for Error;
                      return null;
                      }
                


      }

      }

      EJB StateLessBean which performs the Operation on DB

      @Stateless
      @TransactionManagement(value = TransactionManagementType.BEAN)
      public class XImpl implements XLocal, XRemote {

      Public final Status performDBOperation(DTOObject dtoObject) throws ApplicationException
      {
      // Transcation are all Bean Manaaged Transctions.
                   return status;
      }

      }

      Conversation in Component.xml is as follows;

      <core:manager conversation-id-parameter="cid"/>

      If Action completes in 7-8 minutes, if the stateless bean throws the ApplicationException, seam bean catches, and error message will be shown the same page but if the action takes more than 10 minutes then on GUI the error displayed as follows
      "java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] The transaction is not active!"

      Need any inputs to solve this problem.
      Thanks in Advance.

        • 1. Re: java.lang.IllegalStateException:The transaction is not active!
          pgmjsd

          Check the settings on your transaction monitor (arjuna).   There is a timeout for transactions.


          But... are you saying that this is triggered by a Seam/JSF request and the business logic takes almost 10 minutes to complete?   Does the user actually sit there and stare at a blank screen the whole time?



          Sounds like it should be a background job to me.

          • 2. Re: java.lang.IllegalStateException:The transaction is not active!
            Hi,
            Do you mean to say "!-- JBoss Transactions JTA --> TransactionTimeout"? if yes then the value for TransactionTimeout is 300sec(5 Minutes),
            If I want to change the TransctionTimeout through seam how can i achieve that?
            Do I need to change the converstion timeout also for each Long running conversation and nested conversations?

            Yes, the action is triggered by Seam/JSF request and business logic takes more than 10minutes to complete, For this request user is provided with progress bar and more ever this request is performed once in while like DB backup or restore.
            • 3. Re: java.lang.IllegalStateException:The transaction is not active!
              benitojuarez

              Joshua Davis wrote on May 28, 2009 13:22:


              Sounds like it should be a background job to me.



              cant you do background jobs with Seam?


              BJ

              • 4. Re: java.lang.IllegalStateException:The transaction is not active!

                Hi,


                We need to have that as foreground process where user can be notified with progress of the DB operation.
                So we need to change the transaction timeout for that method only.
                How to change the transaction timout setting ? Best would be a possibity to change it just for one method.

                • 5. Re: java.lang.IllegalStateException:The transaction is not active!
                  pgmjsd

                  Anand Shanwad wrote on May 28, 2009 17:19:


                  Hi,

                  We need to have that as foreground process where user can be notified with progress of the DB operation.
                  So we need to change the transaction timeout for that method only.
                  How to change the transaction timout setting ? Best would be a possibity to change it just for one method.


                  What I meant by 'background' is - not on the HTTP request thread.  It's not a good idea to have the web request threads doing anything that takes more than a second or two. 


                  You could either use a MDB or a separate thread to do the work asynchronously.  The browser can poll for the status periodically.  The status could be in a POJO in one of the contexts, or it could be written to the db.


                  As for modifying the transaction timeout - does this work need to be done in one transaction?  If so, writing the status to the DB obviously won't work unless you use a nested transaction.

                  • 6. Re: java.lang.IllegalStateException:The transaction is not active!

                    Hi,


                    As for modifying the transaction timeout - does this work need to be done in one transaction?
                    yes, I don't need to poll status periodically but I need to modify the transaction timeout for the single action, at end i need to update the user with failure or success result.
                    How to change the transaction timeout setting for single transaction which involved in the opearation?