Bugs item #1056320, was opened at 2004-10-28 12:10
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=1056320&group_id=22866
Category: JBossTX
Group: v3.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Ivan Parra (ioparra)
Assigned to: Nobody/Anonymous (nobody)
Summary: on commit of local jdbc transaction, xa-id is lost
Initial Comment:
JBoss3_2_5 using Oracle Deferred Constraint(constraint
check is done at commit, not update).
When the local transaction commits, the currentXid is
lost before the underlying connection is called to
commit. If the commit call fails, then rollback is not
possible. Below is the stack trace and code snippets.
Stack Trace showing a failed commit on a deferred
constraint.
[2004-10-27 16:37:19,656] TRACE
[org.jboss.tm.TransactionImpl] Committing resources,
resourceStates[0]=3
[2004-10-27 16:37:19,671] WARN
[org.jboss.tm.TransactionImpl] XAException:
tx=TransactionImpl:XidImpl [FormatId=257,
GlobalId=vmoracle//125483, BranchQual=]
errorCode=XA_UNKNOWN(0)
org.jboss.resource.connectionmanager.JBossLocalXAExce
ption: could not commit local tx; - nested throwable:
(org.jboss.resource.JBossResourceException:
SQLException; - nested throwable:
(java.sql.SQLException: ORA-02091: transaction rolled
back
ORA-00001: unique constraint
(DATABASE.UNIQUE_DEFFERED_CONSTRAINT_1) violated
))
at
org.jboss.resource.connectionmanager.TxConnectionMan
ager$LocalXAResource.commit
(TxConnectionManager.java:750)
at
org.jboss.tm.TransactionImpl.commitResources
(TransactionImpl.java:1656)
at org.jboss.tm.TransactionImpl.commit
(TransactionImpl.java:375)
Here is the code for commit:
public void commit(Xid xid, boolean onePhase)
throws XAException
{
if (xid.equals(currentXid) == false)
{
throw new JBossLocalXAException("wrong xid in
commit: expected: " + currentXid + ", got: " + xid);
} // end of if ()
currentXid = null; �------------------------------
--------------------HERE is the problem
try
{
cl.getManagedConnection().getLocalTransaction
().commit();
}
catch (ResourceException re)
{
returnManagedConnection(cl, true);
if (trace)
log.trace("commit problem: ", re);
throw new JBossLocalXAException("could not
commit local tx", re); <-- root of our stack trace
} // end of try-catch
}
The Transaction manager sees this error and then calls
rollback
public void rollback(Xid xid) throws XAException
{
if (xid.equals(currentXid) == false) �-------------
----- THIS CHECK FAILS!!!!
{
throw new JBossLocalXAException("wrong xid in
rollback: expected: " + currentXid + ", got: " + xid); �--
we then get this ST
} // end of if ()
currentXid = null;
try
{
cl.getManagedConnection().getLocalTransaction
().rollback();
}
catch (ResourceException re)
{
returnManagedConnection(cl, true);
if (trace)
log.trace("rollback problem: ", re);
throw new JBossLocalXAException("could not
rollback local tx", re);
} // end of try-catch
}
For clarity, here is the stack trace:
[2004-10-27 16:37:19,812] WARN
[org.jboss.tm.TransactionImpl] XAException:
tx=TransactionImpl:XidImpl [FormatId=257,
GlobalId=vmoracle//125483, BranchQual=]
errorCode=XA_UNKNOWN(0)
org.jboss.resource.connectionmanager.JBossLocalXAExce
ption: wrong xid in rollback: expected: null, got: XidImpl
[FormatId=257, GlobalId=vmoracle//125483,
BranchQual=1]
at
org.jboss.resource.connectionmanager.TxConnectionMan
ager$LocalXAResource.rollback
(TxConnectionManager.java:822)
at
org.jboss.tm.TransactionImpl.rollbackResources
(TransactionImpl.java:1732)
at org.jboss.tm.TransactionImpl.commit
(TransactionImpl.java:405)
Would moving the currentXid after the commit do the
trick?:
try
{
cl.getManagedConnection().getLocalTransaction
().commit();
currentXid = null; � only unset AFTER a
successful call
}
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=1056320&group_id=22866
-------------------------------------------------------
This Newsletter Sponsored by: Macrovision
For reliable Linux application installations, use the industry's leading
setup authoring tool, InstallShield X. Learn more and evaluate
today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development