users@glassfish.java.net

[gf-users] DB operations under XA don't seem to be transactional

From: Pawel Veselov <pawel.veselov_at_gmail.com>
Date: Tue, 13 May 2014 16:58:43 -0700

Hi.

I'm trying to understand if I'm missing something here...

I'm trying to do simple DB operation within XA transaction. The DB
connection that I get from the pool does have auto-commit set to 'true',
which is what it's supposed to be for XA. However, attempting to roll-back
the whole of XA transaction doesn't do anything, and my changes are still
in the DB.

The process I'm using for obtaining an XA connection is - open an XA
transaction, and look up a connection from a XA pool. May be somehow the
connection is not associating with the XA transaction, but I'm not sure
what's the correct way to associate that.

Any pointers will be greatly appreciated. Below is the relevant info, the
JSP deploys in an empty WAR. The JSP outputs:

Before: 3
After: 4

but should output the same numeric value, as the 'update' operation it does
on a table should be rolled back.

JDBC config from domain.xml : http://pastebin.com/QHJNx84u

transaction properties (from asadmin get gfservercf.*):
gfserver.transaction-service.automatic-recovery=true
gfserver.transaction-service.heuristic-decision=rollback
gfserver.transaction-service.keypoint-interval=65536
gfserver.transaction-service.retry-timeout-in-seconds=600
gfserver.transaction-service.timeout-in-seconds=0
gfserver.transaction-service.tx-log-dir=${com.sun.aas.instanceRoot}/logs
gfserver.resource-ref.mi_pe.enabled=true
gfserver.resource-ref.mi_pe.ref=mi_pe

Test JSP: http://pastebin.com/TwVJRJeK


Thank you,
  Pawel.