9 Replies Latest reply on Dec 6, 2006 9:21 PM by richard_djs

    strange! halt of jboss + DB2(XA)

    richard_djs

      I have got an big problem on my J2EE project which was deployed on JBOSS, and my configuation is jboss-4.0.4 + DB2(Version: 8.1.7.445).

      It works correctly when the code is looking like this

      start a transation...
      insert into table OR update table
      submit the transation

      And it will halt at STEP3 when the code is looking like this

      STEP1: start a transation...
      STEP2: insert into table1 ... OR update table1
      STEP3: insert into table2 ... OR update table2
      STEP4: submit the transation

      then an exception will be caught like this "11:39:02,216 WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=d31287/91, BranchQual=, localId=91] timed ut. status=STATUS_ACTIVE"


      How to make it work correctly? I deployed my project as the jboss-4.0.4\docs\examples\jca\db2-xa-ds.xml said.

      By the way, when I deploy my project on WEBLOGIC+DB2, it works OK.

      What should I do?

        • 1. Re: strange! halt of jboss + DB2(XA)
          weston.price

          We will need more of a stacktrace/log file to be able to help. Just to clarify, table1 and table2 exist in the same DB correct? Where are you beginning the transaction from (EJB, Servlet)?

          • 2. Re: strange! halt of jboss + DB2(XA)
            richard_djs

            table1 and table2 are exist in same db. For example, table1 is for business and table2 is for log.

            I start the transation from EJB(Stateless,Bean).
            try
            {
            ut = sessionContext.getUserTransaction();
            ut.begin();
            .......
            ut.commit;
            }
            catch(Exception e){ut.rollback}

            • 3. Re: strange! halt of jboss + DB2(XA)
              richard_djs

              This is the warn infomation in server.log.
              2006-12-05 15:40:10,242 WARN [org.jboss.tm.TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=d31287/89, BranchQual=, localId=89] timed out. status=STATUS_ACTIVE
              2006-12-05 15:41:23,351 WARN [org.jboss.tm.TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=d31287/91, BranchQual=, localId=91] timed out. status=STATUS_ACTIVE
              2006-12-05 15:41:35,664 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
              2006-12-05 15:41:35,664 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=0
              2006-12-05 15:41:35,664 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1165304495664, maxLifeAfterPassivation=1200000
              2006-12-05 15:41:35,664 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
              2006-12-05 15:41:54,633 WARN [org.jboss.tm.TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=d31287/97, BranchQual=, localId=97] timed out. status=STATUS_ACTIVE
              2006-12-05 15:41:54,664 WARN [org.jboss.tm.TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=d31287/98, BranchQual=, localId=98] timed out. status=STATUS_ACTIVE
              2006-12-05 15:42:03,086 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
              2006-12-05 15:49:33,086 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
              2006-12-05 15:51:31,992 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
              2006-12-05 15:51:31,992 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=0
              2006-12-05 15:51:31,992 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1165305091992, maxLifeAfterPassivation=1200000
              2006-12-05 15:51:31,992 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done



              • 4. Re: strange! halt of jboss + DB2(XA)
                weston.price

                You are going to have to turn on TRACE level debugging in your log4j.xml configuration file for JBossJCA. There are a few examples in the log4j.xml config file that show you how to do this.

                Also, could you post your ejb-jar.xml (if EJB2.x) and your *-ds.xml file.

                • 5. Re: strange! halt of jboss + DB2(XA)
                  richard_djs

                  Thank you for your reply.

                  Yesterday, I tried the deployment with db2(non xa) , it works well. I think the class is ok, there must be somthing wrong in my jboss configuation.

                  This are my ejb-jar.xml and db2-xa-ds.xml.

                  <?xml version="1.0" encoding="UTF-8"?>
                  <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
                  <ejb-jar>
                  <display-name>SysmgrEJBModule</display-name>
                  <enterprise-beans>


                  <ejb-name>PostMgmtSession</ejb-name>
                  com.oss.sysmgr.ejbs.PostMgmtSessionHome
                  com.oss.sysmgr.ejbs.PostMgmtSession
                  <ejb-class>com.oss.sysmgr.ejbs.PostMgmtSessionBean</ejb-class>
                  <session-type>Stateless</session-type>
                  <transaction-type>Bean</transaction-type>


                  </enterprise-beans>
                  <assembly-descriptor>
                  <container-transaction>

                  <ejb-name>PostMgmtSession</ejb-name>
                  <method-name>*</method-name>


                  <trans-attribute>Required</trans-attribute>
                  </container-transaction>
                  </assembly-descriptor>
                  </ejb-jar>




                  <?xml version="1.0" encoding="UTF-8"?>

                  <!-- ===================================================================== -->
                  <!-- -->
                  <!-- JBoss Server Configuration -->
                  <!-- Thanks to Horia Muntean <horia@bvb.ro> -->
                  <!-- ===================================================================== -->

                  <!-- $Id: db2-xa-ds.xml,v 1.4 2004/09/15 14:37:40 loubyansky Exp $ -->



                  <!--
                  XADatasource for DB2 V8.1 (app driver)
                  copy $db2_install_dir/java/db2java.zip into $jboss_install_dir/server/default/lib
                  -->

                  <xa-datasource>
                  <jndi-name>DSTopEng</jndi-name>

                  <xa-datasource-class>COM.ibm.db2.jdbc.DB2XADataSource</xa-datasource-class>
                  <xa-datasource-property name="DatabaseName">BOSSDB2</xa-datasource-property>
                  <xa-datasource-property name="User">topeng</xa-datasource-property>
                  <xa-datasource-property name="Password">bossDB2</xa-datasource-property>

                  <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->

                  <type-mapping>DB2</type-mapping>

                  </xa-datasource>

                  <xa-datasource>
                  <jndi-name>DSAudit</jndi-name>

                  <xa-datasource-class>COM.ibm.db2.jdbc.DB2XADataSource</xa-datasource-class>
                  <xa-datasource-property name="DatabaseName">BOSSDB2</xa-datasource-property>
                  <xa-datasource-property name="User">USER_AUDIT</xa-datasource-property>
                  <xa-datasource-property name="Password">bossDB2</xa-datasource-property>

                  <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->

                  <type-mapping>DB2</type-mapping>

                  </xa-datasource>


                  • 6. Re: strange! halt of jboss + DB2(XA)
                    richard_djs

                    I made some simple test, and find if the old connection not close it will be halt when a new connection create.

                    It will be hold at STEP3

                    STEP1: create connection1
                    STEP2: insert table1
                    STEP3: create connection2
                    STEP4: inset table2
                    STEP5: close connection1
                    STEP6: close connection2


                    It will be OK when looks like

                    create connection1
                    insert table1
                    close connection1
                    create connection2
                    insert table2
                    close connection2


                    Has anybody meet the kind of error?

                    • 7. Re: strange! halt of jboss + DB2(XA)
                      weston.price

                      Add the following to your *-ds.xml file for each XA datasource.

                      <track-connection-by-tx/>

                      This will allow connection sharing as well as keep the connection open until the transaction completes.

                      • 8. Re: strange! halt of jboss + DB2(XA)
                        weston.price

                        I did some tests and the following is going to be required in your *-ds.xml file.

                        <isSameRM-override-value>false</isSameRM-override-value>

                        IBM DB2 XA seems to suffer from the same Oracle issue wherein enlisting two managed connections within the same XA transaction will not work if the underlying resource manager is the same.


                        Add this to your *-ds.xml file(s) and you should be all set.


                        • 9. Re: strange! halt of jboss + DB2(XA)
                          richard_djs

                          Thank you very much! I've solved this problem as what you suggest.