activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbarlabanov <cont...@sergiy-barlabanov.de>
Subject XAException: The connection is already closed
Date Wed, 21 Nov 2012 17:26:43 GMT
Hi,
we are using Embedded ActiveMQ with resource adapter in a Glassfish Server
3.1.2.2.
When the server is being stopped, we observe XAExceptions in the log file
saying that the underlying ActiveMQ connection is already closed. According
to the ActiveMQ logs all connections are stopped before the corresponding
transactions commit or rollback. So we use the following code to reproduce
the problem:

UserTransaction ut = ...; // obtained from the JEE
ut.begin();
openConnectionAndDoBlockingReceiveAndThenCloseTheConnection();
ut.commit();

openConnectionAndDoBlockingReceiveAndThenCloseTheConnection blocks for about
20 seconds on consumer.receive. If during this time the server is going
down, receive returns null and the method
openConnectionAndDoBlockingReceiveAndThenCloseTheConnection ends without
problems. But "ut.commit()" throws a javax.transaction.SystemException
saying that Glassfish failed to commit since the connection is already
closed. Below is the stack trace.
In the ActiveMQ log we see, that the broker is going down closing all
connections. The resource adapter and the corresponding Glassfish connection
pool are still there and ActiveMQManagedConnection is not closed yet.
Is it like an error in the shutdown sequence of the embedded broker and the
resource adapter?
In the ActiveMQ log we see also, that ActiveMQ also rolls back the
corresponding transaction. But the Glassfish does not know about it anything
and still tries to commit it. Maybe the resource adapter has to mark the
transaction for rollback somehow to let the container know about the
rollback done by the broker?

So somehow there the things mixed up.
Actually I would expect that the resource adapter first closes all managed
connections, sessions and consumers and wait until all pending transactions
are closed and only after all that it should stop the embedded broker. Am I
wrong? Or do I expect too much? Otherwise is the shutdown procedure of the
broker embedded in a JEE environment is wrong.


2012-11-21 17:44:21,471 [/1       ] DEBUG                     
org.apache.activemq.transaction.XATransaction#     XA Transaction rollback:
XID:[4871251,globalId=2000fffffffceffffffdb237365726769792e6c6f63616c2c7365727665722c5039303337,branchId=7365726769792e6c6f63616c2c7365727665722c50393033372c0]

and just a few lines after that we get:

2012-11-21 17:44:21,475 [/9080(4) ] WARN                             
org.apache.activemq.TransactionContext#     commit of:
XID:[4871251,globalId=2000fffffffceffffffdb237365726769792e6c6f63616c2c7365727665722c5039303337,branchId=7365726769792e6c6f63616c2c7365727665722c50393033372c0]
failed with: org.apache.activemq.ConnectionClosedException: The connection
is already closed
	at
org.apache.activemq.ActiveMQConnection.checkClosed(ActiveMQConnection.java:1462)
~[activemq-core-5.7.0.jar:na]
	at
org.apache.activemq.ActiveMQConnection.checkClosedOrFailed(ActiveMQConnection.java:1449)
~[activemq-core-5.7.0.jar:na]
	at
org.apache.activemq.TransactionContext.commit(TransactionContext.java:549)
~[activemq-core-5.7.0.jar:na]
	at
org.apache.activemq.ra.LocalAndXATransaction.commit(LocalAndXATransaction.java:85)
[activemq-ra-5.7.0.jar:na]
	at
com.sun.jts.jtsxa.OTSResourceImpl.commit_one_phase(OTSResourceImpl.java:174)
[jts.jar:3.1.2.1-SNAPSHOT]
	at
com.sun.jts.CosTransactions.RegisteredResources.commitOnePhase(RegisteredResources.java:1565)
[jts.jar:3.1.2.1-SNAPSHOT]
	at
com.sun.jts.CosTransactions.TopCoordinator.commitOnePhase(TopCoordinator.java:2956)
[jts.jar:3.1.2.1-SNAPSHOT]
	at
com.sun.jts.CosTransactions.CoordinatorTerm.commit(CoordinatorTerm.java:322)
[jts.jar:3.1.2.1-SNAPSHOT]
	at
com.sun.jts.CosTransactions.TerminatorImpl.commit(TerminatorImpl.java:250)
[jts.jar:3.1.2.1-SNAPSHOT]
	at com.sun.jts.CosTransactions.CurrentImpl.commit(CurrentImpl.java:633)
[jts.jar:3.1.2.1-SNAPSHOT]
	at
com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:332)
[jts.jar:3.1.2.1-SNAPSHOT]


Best regards,
Sergiy




--
View this message in context: http://activemq.2283324.n4.nabble.com/XAException-The-connection-is-already-closed-tp4659646.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message