1 2 Previous Next 20 Replies Latest reply on Nov 2, 2003 11:18 AM by adrian.brock

    unable to commit with JBoss 3.2.2

    juergenschwarz

      Hi,

      i have the strange problem, that everytime i want to access a database from an EJB i get the error:
      org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=pc12//19, BranchQual=] status=STATUS_NO_TRANSACTION

      With JBoss 3.0.8 and JBoss 3.2.1 everything works fine.
      Whats wrong ?

      Juergen

        • 1. Re: unable to commit with JBoss 3.2.2
          fral

          I have the same problem. My application worked just fine in JBoss 3.2.1, but with JBosss 3.2.2 I get the same error as you do.

          Any ideas anyone.

          /Fredrik

          • 2. Re: unable to commit with JBoss 3.2.2
            fral

            Ooh, and I don't do any updates when this happens. I only do a findAll... And it's with a XA DataSource.

            /Fredrik

            • 3. Re: unable to commit with JBoss 3.2.2
              fral

              I have tested the JBoss 3.2.2RCs now, and in RC3 and RC4, the same error occurs. In RC2 it works as it did in JBoss 3.2.1. It also works fine in JBoss 4 DR2.

              /Fredrik

              • 4. Re: unable to commit with JBoss 3.2.2

                Show the full stack trace and the example code.

                Regards,
                Adrian

                • 5. Re: unable to commit with JBoss 3.2.2
                  fral

                  Ok,

                  Server.log cotains the stacktrace.

                  I start by calling a SessionBean called BookManager from the web layer in BookListBean. In the BookManager I call findAll on the Book EntityBean. I the build a Collection of value beans in BookManager that I return to the weblayer where it's displayed.

                  I haven't declared any conatiner transactions in ejb-jar.xml. Has the default changed?

                  Is this enough?

                  • 6. Re: unable to commit with JBoss 3.2.2

                    I'm interested in what the invoking (controlling) code is doing
                    not the bean.

                    Can you modify conf/log4j.xml to enable TRACE for
                    org.jboss.tm and
                    org.jboss.ejb.plugins

                    You will an example commented out for org.jboss.ejb.plugins.

                    This will show the transaction demaraction for the ejbs
                    and what the transaction manager is doing.

                    If this is multi threaded, you might want to add
                    {%t} to the pattern of the server log to show the thread.

                    Regards,
                    Adrian

                    • 7. Re: unable to commit with JBoss 3.2.2

                      The defaults has always been "Required", but it is
                      good practice to be explicit. Other containers might have
                      different defaults (it is not defined by the spec).

                      Regards,
                      Adrian

                      • 8. Re: unable to commit with JBoss 3.2.2
                        fral

                        Adrian,

                        Hare are a server.log with TRACE enabled for plugins and tm.

                        Yes, I know tha't good practise. This is a application that was developed as an example on how to use Struts, without EJBs. The EJB part was added just for fun so I haven't put that much work into it.

                        Regars,
                        Fredrik

                        • 9. Re: unable to commit with JBoss 3.2.2

                          This is a bug, but can you post your -ds.xml?
                          Which db do you have?
                          Aren't you using <track-connection-by-tx/>?

                          Regards,
                          Adrian

                          • 10. Re: unable to commit with JBoss 3.2.2

                            This diff should fix the problem (I don't think it will apply
                            directly over the 3.2.2 source)

                            Index: XAManagedConnection.java
                            ===================================================================
                            RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/adapter/jdbc/xa/XAManagedConnection.java,v
                            retrieving revision 1.3.2.10
                            diff -r1.3.2.10 XAManagedConnection.java
                            159c159
                            < if (currentXid.equals(xid))
                            ---
                            > if (currentXid != null && currentXid.equals(xid))

                            Regards,
                            Adrian

                            • 11. Re: unable to commit with JBoss 3.2.2
                              fral

                              No, I'm not using track-connection-by-tx. Will it help?
                              I'm using Mimer SQL. I sent you a mimersql-xa-ds.xml a couple of days ago and you added it to the source. Should <track-connection-by-tx>true</track-connection-by-tx> be part of it?

                              Regards,
                              Fredrik

                              • 12. Re: unable to commit with JBoss 3.2.2
                                fral

                                Adrian,

                                I added <track-connection-by-tx>true</track-connection-by-tx> to mimersql-xa-ds.xml, and now it works great. Maybe the example mimersql-xa-ds.xml should be modified so that <track-connection-by-tx>true</track-connection-by-tx> is part of it?

                                Thanks a lot for your help.

                                Regards,
                                Fredrik

                                • 13. Re: unable to commit with JBoss 3.2.2

                                  Most XA datasources don't support commit from suspended,
                                  e.g. Oracle and My SQL doesn't.

                                  If your db does support commit from suspended, i.e. you
                                  can have multiple XAResources associated with a connection
                                  (only one is allowed to be active at any one time) but
                                  you can commit any of the XAResources at any time
                                  the pooling will be more efficient.

                                  If it doesn't support it, you have to use <track-connection-by-tx>
                                  so the connection isn't returned to the pool until the
                                  transaction commits.

                                  Can you try the patch to see whether mimer supports it?
                                  You need to hit it with mulitple concurrent threads to
                                  properly test it.

                                  Regards,
                                  Adrian

                                  • 14. Re: unable to commit with JBoss 3.2.2

                                    P.S. It wasn't a problem with 3.2.1 because it was incorrectly
                                    doing :
                                    if (currentXid == Xid)
                                    which doesn't necessarily work with
                                    a distributed transaction manager

                                    Regards,
                                    Adrian

                                    1 2 Previous Next