Gerald Turner <[EMAIL PROTECTED]> writes:

> I'll build the latest Branch_3_0 and give that a try.

Good news!

David's changes to 3.0.7RC1 have fixed this problem!

I noticed one minor problem: neither XAException, nor SQLException are
nested in the TransactionRolledbackException.  The exception I get is:

  java.rmi.ServerException (if remote)
   -> org.jboss.tm.JBossTransactionRolledbackException
       -> org.jboss.tm.JBossRollbackException
           -> null

I looked at the code for TxCapsule and it would appear that the
JBossRollbackException is initialialized with the XAException thrown in
commitResources but the 'cause' field is nulled by instanceDone first!

Even if that gets fixed I think it'd be really nice if the origin of the
XAException, in this case the commit method in LocalTxConnectionManager,
would include information about it's linkedException in the message.  I
inserted the following code in order to get ludicrous amounts of
SQLException information:

            StringBuffer message =
                new StringBuffer("Could not commit local tx: "
                                 + re.getMessage());
            boolean paren = false;
            if (re.getErrorCode() != null) {
                if (!paren) {
                    message.append(" (");
                    paren = true;
                }
                message.append("ErrorCode: ");
                message.append(re.getErrorCode());
            }
            if (re.getLinkedException() != null) {
                if (!paren) {
                    message.append(" (");
                    paren = true;
                }
                Exception linked = re.getLinkedException();
                message.append("LinkedException: ");
                message.append(linked);
                if (linked instanceof SQLException) {
                    SQLException sql = (SQLException) linked;
                    while (sql != null) {
                        message.append("; SQLException");
                        boolean comma = false;
                        if (sql != linked) {
                            if (comma)
                                message.append(',');
                            message.append(" Message=");
                            message.append(sql.getMessage());
                            comma = true;
                        }

                        if (comma)
                            message.append(',');
                        message.append(" ErrorCode=");
                        message.append(sql.getErrorCode());
                        comma = true;

                        if (comma)
                            message.append(',');
                        message.append(" SQLState=");
                        message.append(sql.getSQLState());
                        comma = true;

                        sql = sql.getNextException();
                    }
                }
            }
            if (paren)
                message.append(')');

            XAException e = new XAException(message.toString());
            if (re.getCause() == null && re.getLinkedException() !=
            null)
                e.initCause(re.getLinkedException());
            else
                e.initCause(re);


An example message looks like this:

  Could not commit local tx: SQLException (LinkedException: java.sql.SQLException: 
ORA-02091: transaction rolled back\nORA-02290: check constraint (OMS.SYS_C004928) 
violated\n; SQLException ErrorCode=2091, SQLState=42000)

Which is cool because somebody can figure out what SYS_C004928 is made
out of.

-- 
Gerald Turner    Email: [EMAIL PROTECTED]    Phone: (503) 788-1720
GPG: 0xFA8CD6D5  21D9 B2E8 7FE7 F19E 5F7D  4D0C 3FA0 810F FA8C D6D5


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to