6 Replies Latest reply on Oct 1, 2010 5:36 AM by Lily Chen

    massive loading problem

    Lily Chen Newbie

      Hi,


      I am working on an applictaion to load records to DB. It works well with small loading such as a few thousands of records. But it failed when massive loadings such as more than 10,000 records.


      My DB loading method is:


      @PersistenceContext
          private EntityManager em;
      em.persist(record);
      




      The error message I got is:


      09:50:59,299 ERROR [JDBCExceptionReporter] Transaction is not active: tx=TransactionImple < ac, BasicAction: a212cf7:9a2:4ca04ad8:7c status: ActionStatus.ABORTING >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: a212cf7:9a2:4ca04ad8:7c status: ActionStatus.ABORTING >)
      09:50:59,419 ERROR [TxPolicy] javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Cannot open connection
      09:50:59,429 SEVERE [application] javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Cannot open connection
      javax.faces.el.EvaluationException: javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Cannot open connection
           at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
           at javax.faces.component.UICommand.broadcast(UICommand.java:387)
      ..........     
      Caused by: javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Cannot open connection
           at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:115)
      



      Anyone had the similar problem before and what's the solution?


      Many thanks!


        • 1. Re: massive loading problem
          Leo van den berg Master

          Hi,


          your connection is timing out, so you should try the following:


          . Handle the inserts in a Asynchronous method and if that doesn't help, chop your inserts in smaller pieces, meaning do an insert in the DB every N-objects.


          Leo

          • 2. Re: massive loading problem
            Lily Chen Newbie

            Hi,


            Thanks a lot for your help.


            I can't chop the inserts to small parts because in case something wrong, I need to rollback all records to make sure either 0 or all in DB in one loading.


            Just curious, any solutions to change the connection time out configuration?


            Thanks a lot again.

            • 3. Re: massive loading problem
              Leo van den berg Master

              Hi,


              I can only give you the hint to look at your Application server's configuration.
              I have never done this, but you can change setting in the services for JBoss under the deploy directory. The file transaction-jboss-beans.xml contains the transaction settings, but be aware that this is specialist work and you shouldn't change things before knowing exactly what the change can inluence in other parts of the Application server !!


              Leo

              • 4. Re: massive loading problem
                Mark Wigmans Newbie

                If you are using Jboss 4.2.3 I had a similar problem and solved it by changing the jboss timeout value:


                jboss-service.xml:


                   <!-- 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>





                I changed the 'TransactionTimeout' value.


                In my case the transaction contained much more than 10.000 objects to be stored (200.000 objects). to speed up performance, objects had to be removed from the first order cache (JPA flush() and clear() on the entityManager).

                • 5. Re: massive loading problem
                  Khosro Asgharifard Sharabiani Newbie

                  Hi,


                  We have the same issue ,when we want to index 50000 records by hibernate search.In each request to DB(it is Oracle)we fetch 1000 records,but in fetching records 7000(in request number 7) we got the same exception. We use JBoss 5.1.I really do not know ,why this happens.Then we switch from

                  JTA

                  to
                  RESOURCE_LOCAL

                  transaction to index such data.
                  If any one knows any solution in JBoss 5.1 using JTA transaction,please help us.


                  Khosro.

                  • 6. Re: massive loading problem
                    Lily Chen Newbie

                    Same as Mark mentioned in the last post, I fixed the original problem by changing the TransactionTimeout in  transaction-jboss-beans.xml. I am using the JBoss 5.1.0.


                    But my application still failed. The Jboss server closed the connection after hours loading.


                    '01:10:09,660 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_18] - TransactionReaper::check timeout for TX a212cf7:11fa:4ca1ff9f:72 in state  CANCEL
                    01:10:10,802 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_18] - TransactionReaper::check timeout for TX a212cf7:11fa:4ca1ff9f:72 in state  CANCEL_INTERRUPTED
                    01:10:10,802 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_6] - TransactionReaper::check worker Thread[Thread-10,5,jboss] not responding to interrupt when cancelling TX a212cf7:11fa:4ca1ff9f:72 -- worker marked as zombie and TX scheduled for mark-as-rollback
                    01:10:10,802 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_11] - TransactionReaper::check failed to mark TX a212cf7:11fa:4ca1ff9f:72  as rollback only
                    01:10:13,095 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_13] - TransactionReaper::doCancellations worker Thread[Thread-10,5,jboss] missed interrupt when cancelling TX a212cf7:11fa:4ca1ff9f:72 -- exiting as zombie (zombie count decremented to 0)
                    01:10:13,095 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: null
                    01:10:13,095 ERROR [JDBCExceptionReporter] Connection handle has been closed and is unusable
                    01:10:13,125 INFO  [CachedConnectionManager] Closing a connection for you.  Please close them yourself: org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6@14ab6ce
                    01:10:13,726 ERROR [TxPolicy] javax.ejb.NoSuchEJBException: Could not find Stateful bean: ax186v-ibu3rw-gemvq7it-1-gemvwara-a4
                    01:10:13,726 SEVERE [application] javax.ejb.NoSuchEJBException: Could not find Stateful bean: ax186v-ibu3rw-gemvq7it-1-gemvwara-a4
                    javax.faces.el.EvaluationException: javax.ejb.NoSuchEJBException: Could not find Stateful bean: ax186v-ibu3rw-gemvq7it-1-gemvwara-a4
                         at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
                         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                    



                    So I had to split the file to 3 smaller files and loaded them separately. And each of them took a couple of hours to load.