4 Replies Latest reply on Jun 8, 2007 2:52 AM by Toni Beckman

    No active transaction?

    Toni Beckman Novice

      Hi,

      in my seam application the user can start a batch process, by clicking on a link in the web application.

      When he clicks on that link the method of a SFSB is called, which in turn direktly calls the method of a SLSB where the job actually gets done.

      The processing runs for about 1h and 43 minutes and then I get the following exception.

      I have no idea why. Is the transaction timing out or does the connection to the database close?

      2007-06-07 01:43:18,456 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: null
      2007-06-07 01:43:18,456 ERROR [org.hibernate.util.JDBCExceptionReporter] Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=helsinki/214, BranchQual=, localId=214]; - nes
      2007-06-07 01:43:18,462 ERROR [org.jboss.seam.web.ExceptionFilter] uncaught exception
      javax.servlet.ServletException: Error calling action method of component with id _idJsp32:_idJsp89
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
       at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
       at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
       at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
       at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
       at java.lang.Thread.run(Thread.java:619)


        • 1. Re: No active transaction?
          Gavin King Master

          Most TMs have some kind of transaction timeout if a tx lasts too long. That might be a problem here.

          • 2. Re: No active transaction?
            Toni Beckman Novice

            What is the best approach then for a task which might last for 1-6 hours, which is the case with mine. I have increased the transaction timeout already to 2h, but yesterday the task stopped after 2h, without raiging any exceptions.

            I found the following message in the logs:


            2007-06-08 03:59:59,945 WARN [org.jboss.tm.TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=www.timsvenson.de/870, BranchQual=, localId=870] timed out. status=STATUS_AC


            From my own application log messages I can tell, that the task is not being completed. Is there a way not to run this task within a transaction?

            I already thought of marking the method with TransactionAttributeType.REQUIRES_NEW, but I'm not sure if this would solve the problem, as there still would be the outer transaction, which probably would time out after 2 h nevertheless.

            What's the best approach?

            • 3. Re: No active transaction?
              Gavin King Master

              Well, I'm not sure this discussion really belongs in the Seam forum, but if all the work *really* needs to take place in one transaction, there is usually a programmatic way to set the transaction timeout for the current transaction. For example: UserTransaction.setTransactionTimeout().

              Otherwise, span the work across multiple transactions.

              • 4. Re: No active transaction?
                Toni Beckman Novice

                But the outer transaction is always bound to the TransactionTimeout. In essence I'm just looking for a way so that a method is allowed to run as long as it needs to to get the job done. Is it possible in seam to run the whole batch without a transaction?