4 Replies Latest reply on Aug 14, 2007 9:03 AM by Tracy Hartley

    SQL Exception reporting when transaction fails on commit

    Tracy Hartley Newbie

      I'm using JBoss 4.2.0.GA.

      I have a transaction that updates multiple tables then tries to commit. The commit fails due to an integrity constraint failing.

      In the error log all I get is the following:
      2007-08-14 08:52:32,640 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.parentTraceEnabled=true
      2007-08-14 08:52:32,640 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.nestedTraceEnabled=false
      2007-08-14 08:52:32,640 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.detectDuplicateNesting=true
      2007-08-14 08:52:32,640 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException in method: (my method), causedBy:
      javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state
      at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commit(TransactionImple.java:243)
      at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
      at org.jboss.ejb.Container.invoke(Container.java:960

      So there is no clue as to what the real error is.

      However if I run the same code under 4.0.5 I get

      2007-08-14 09:54:43,781 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException in method: (my method), causedBy:
      org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=A06087/89, BranchQual=, localId=89] status=STATUS_NO_TRANSACTION; - nested throwable: (org.jboss.resource.connectionmanager.JBossLocalXAException: could not commit local tx; - nested throwable: (org.jboss.resource.JBossResourceException: SQLException; - nested throwable: (java.sql.SQLException: ORA-02091: transaction rolled back
      ORA-02292: integrity constraint (TEST.RP_FK_MAT_ALTERATIONSPEC_2) violated - child record found
      )))
      at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:372)
      at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)


      How can I get the SQL error reported the same way in 4.2.0??