4 Replies Latest reply on Dec 9, 2009 4:56 AM by Premraj Warke

    transaction closed ... guess timeout problem

    Christopher Rivera Newbie

      Hi

      i am a pretty new EJB 3.0 noob ... so perhaps someone can help me

      package com.business;
      
      import javax.ejb.Local;
      import javax.ejb.Stateless;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      import javax.persistence.Query;
      
      import com.entity.InterfaceInXmlQueueDtl;
      import com.inter.InterfaceInXmlQueueDtlInter;
      
      @Stateless
      @Local(InterfaceInXmlQueueDtlInter.class)
      public class InterfaceInXmlQueueDtlEJB implements InterfaceInXmlQueueDtlInter
      {
       @PersistenceContext(unitName = "TestEJB")
       private EntityManager em;
      
       public void getList()
       {
       long now = System.currentTimeMillis();
       for (int i = 0; i < 10000; i++)
       {
       Query q = em.createQuery("from InterfaceInXmlQueueDtl");
       q.setMaxResults(1);
       q.setFirstResult(i);
       InterfaceInXmlQueueDtl x = (InterfaceInXmlQueueDtl) q.getSingleResult();
       //System.out.println(x.getPk().getSequenceNum());
      
       }
       long end = System.currentTimeMillis();
       System.out.println((end - now) / 1000);
       }
      
      }



      so i have a table that has in total 2.000.000 rows and i am just trying to do a performance check on ejb 3...
      so all i do is looping through the first 10.000 and try to load the bean... and then just stop the time of how long it took...

      so my problem is now after about 5000 rows or something it throws an exception saying that the transaction is not active and the session is closed...

      could this be an timeout error ??
      if not what else could it be ?

      Thanks for any help

        • 1. Re: transaction closed ... guess timeout problem
          Christopher Rivera Newbie

          here is the thrown error


          
          15:30:40,394 INFO [EARDeployer] Started J2EE application: file:/C:/Program Files/jboss-4.2.2.GA/server/default/deploy/TestEAR.ear
          15:36:05,769 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id a720177:484:479f6711:18a invoked while multiple threads active within it.
          15:36:05,769 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action a720177:484:479f6711:18a aborting with 1 threads active!
          15:36:05,800 INFO [DateType] could not read column value from result set: CREATE9_76_; The result set is closed.
          15:36:05,800 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
          15:36:05,800 ERROR [JDBCExceptionReporter] The result set is closed.
          15:36:05,800 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_40] - Abort called on already aborted atomic action a720177:484:479f6711:18a
          15:36:05,816 ERROR [TxConnectionManager] There is something wrong with the pooling?
          java.lang.IllegalStateException: afterCompletion called with wrong tx! Expected: TxSync8710990{tx=TransactionImple < ac, BasicAction: a720177:484:479f6711:18a status: ActionStatus.ABORTED > wasTrackByTx=true enlisted=true}, actual: null
           at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener$TransactionSynchronization.afterCompletion(TxConnectionManager.java:819)
           at org.jboss.resource.connectionmanager.TransactionSynchronizer.invokeAfter(TransactionSynchronizer.java:301)
          
          


          • 2. Re: transaction closed ... guess timeout problem
            Christopher Rivera Newbie

            the above error is weird and just happend once now...

            this is the standard error that i get:

            15:42:31,784 INFO [Server] JBoss (MX MicroKernel) [4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)] Started in 1m:609ms
            15:47:39,316 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id a720177:74c:479f8f86:31 invoked while multiple threads active within it.
            15:47:39,316 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action a720177:74c:479f8f86:31 aborting with 1 threads active!
            15:47:39,331 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_40] - Abort called on already aborted atomic action a720177:74c:479f8f86:31
            15:47:39,363 ERROR [[test]] Servlet.service() for servlet test threw exception
            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.commitAndDisassociate(TransactionImple.java:1379)
             at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
            


            • 3. Re: transaction closed ... guess timeout problem
              jaikiran pai Master

               

              could this be an timeout error ??


              Probably yes. The default transaction timeout is 5 minutes (i.e. 300 seconds). If you want to have long running transactions then change this default value in jboss-service.xml file under server/xxx/conf folder:
              <!-- JBoss Transactions JTA -->
               <mbean code="com.arjuna.ats.jbossatx.jta.TransactionManagerService"
               name="jboss:service=TransactionManager">
               <attribute name="TransactionTimeout">300</attribute>
               <attribute name="ObjectStoreDir">${jboss.server.data.dir}/tx-object-store</attribute>
               </mbean>


              There are a couple of transaction timeout values in that file (one for pre 4.2 JBoss version), so make sure you change the right one.


              • 4. Re: transaction closed ... guess timeout problem
                Premraj Warke Newbie

                increase the timeout period

                Regards,
                Premraj