experiencing "BitronixXAException: resource already started on XID a Bitronix XID"
cyu021 Nov 30, 2016 11:37 AMHi,
I embed jbpm (6.1.0) in a webapp built on spring framework (3.1.2), and it run well for most of the time.
However, I receive "BitronixXAException" from time to time, and I have to restart my tomcat instance whenever it occurs.
Following is the final part of exception stack trace:
Caused by: java.sql.SQLException: error enlisting a JdbcConnectionHandle of a JdbcPooledConnection from datasource jdbc/testDS in state ACCESSIBLE with usage count 1 wrapping a JDBC LrcXAConnection on com.mysql.jdbc.JDBC4Connection@44518021 on a JDBC LrcConnectionHandle on a JDBC LrcXAResource in state NO_TX
at bitronix.tm.resource.jdbc.JdbcConnectionHandle.enlistResource(JdbcConnectionHandle.java:87)
at bitronix.tm.resource.jdbc.JdbcConnectionHandle.prepareStatement(JdbcConnectionHandle.java:265)
at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at bitronix.tm.resource.jdbc.BaseProxyHandlerClass.invoke(BaseProxyHandlerClass.java:64)
at com.sun.proxy.$Proxy18.prepareStatement(Unknown Source)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$2.doPrepare(StatementPreparerImpl.java:117)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:183)
... 92 more
Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an XAResourceHolderState with uniqueName=jdbc/testDS XAResource=a JDBC LrcXAResource in state NO_TX with XID a Bitronix XID [31302E3230302E31302E323239000000000BEECC4C00000134 : 31302E3230302E31302E323239000000000BEECC4C00000135], error=XAER_PROTO
at bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:139)
at bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:69)
at bitronix.tm.resource.jdbc.JdbcConnectionHandle.enlistResource(JdbcConnectionHandle.java:85)
... 100 more
Caused by: bitronix.tm.internal.BitronixXAException: resource already started on XID a Bitronix XID [31302E3230302E31302E323239000000000AEB6B3900000122 : 31302E3230302E31302E323239000000000AEB6B3900000123]
at bitronix.tm.resource.jdbc.lrc.LrcXAResource.start(LrcXAResource.java:123)
at bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:220)
at bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
at bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:130)
... 102 more
I found a discussion on similar issue back in 2011:
"
I think after some investigation I'm
leaning toward this being an application issue and not something
inherently wrong in Bitronix. I wrote a simple little test and verified
that this error happens whenever a javax.sql.Connection gets reused
across multiple concurrent transactions in different threads. So I
think there is probably something going wrong "above" the tm/pooling layer.
"
Unfortunately, this discussion is yet unsolved.
I wonder what may cause this exception and how can I avoid or workaround it?
Thank you for your time.