QPID JMS client throws an exception during Failover: Session not transacted after failover
Issue
- When a session is committed after failover using the session.commit() call, it incorrectly throws a RuntimeException (SessionException). It should throw a JMSException instead so that the client can recover.
-
To reproduce the problem:
- Run two brokers in a cluster
-
Compile and run the reproducer program below
-
Kill broker to which the client is connected to when the reproducer program prompts
- This generates the following result:
Sent message: foo
Kill broker within 5 seconds
Exception occurred: org.apache.qpid.transport.SessionException: Session failed over, possibly in the middle of a transaction. Closing the session. Any Transaction in progress will be rolledback.
org.apache.qpid.transport.SessionException: Session failed over, possibly in the middle of a transaction. Closing the session. Any Transaction in progress will be rolledback.
at org.apache.qpid.transport.Session.invoke(Session.java:541)
at org.apache.qpid.transport.Session.invoke(Session.java:528)
at org.apache.qpid.transport.SessionInvoker.txCommit(SessionInvoker.java:148)
at org.apache.qpid.client.AMQSession_0_10.sendCommit(AMQSession_0_10.java:415)
at org.apache.qpid.client.AMQSession_0_10.commit(AMQSession_0_10.java:981)
at TxFailover.main(TxFailover.java:34)
- The following result is expected however:
Sent message: foo
Kill broker within 5 seconds
Creating new session; transaction rolledback due to exception: javax.jms.TransactionRolledBackException: Connection failover has occured since last send. Forced rollback
javax.jms.TransactionRolledBackException: Connection failover has occured since last send. Forced rollback
at org.apache.qpid.client.AMQSession.commit(AMQSession.java:856)
at TxFailover.main(TxFailover.java:34)
Sent message: foo
Committed
Environment
- Red Hat Enterprise MRG 2.0
- qpid-java-0.10-6.el5
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.