We are building a small test-app to evaluate solutions to the problem posted by michaelzilske in
http://www.nabble.com/Messages-out-of-sequence-%28jboss-and-swiftmq%29-td12734756.htmlOur test-app starts a transaction, sends 5 messages in it and commits. For each message it does the following:
- retrieve a connection from a SingleSharedConnectionFactory and invoke start() on it
- create Session, MessageProducer and Message
- send the message
- close producer, session and connection
The first transaction works fine. The second one gives the following exception when trying to invoke start() on the connection for the first time:
javax.jms.IllegalStateException: This connection is not associated with a ManagedConnection instance!
at com.swiftmq.connector.v15.outbound.ConnectionImpl.start(Unknown Source)
at com.swiftmq.jms.springsupport.SharedJMSConnection.start(Unknown Source)
at de.ivu.jmsxatest.beans.JMSXAFacadeImpl.sendMessageAndCloseConnection(JMSXAFacadeImpl.java:54)
[...]
The setup is as follows:
- Websphere 6.1 with SwiftMQ 7.5.4 (extra-vm via RA)
- JMSXAFacadeImpl is a Spring bean into which an instance of SingleSharedConnectionFactory is injected. We have also tried Spring's SingleConnectionFactory and CachingConnectionFactory. They exhibit the same behaviour.
- Transaction manager is JTA as defined by spring config (<tx:jta-transaction-manager/>)
A test EAR that exhibits the described behaviour is attached
jmsxatestEAR.ear (contains source code) If deployed it offers a servlet under /jmsxatestservlet/test. Each call to the servlet corresponds to one transaction, hence you need to call it twice. The EAR uses the JNDI-Names "jms/CF" and "jms/testqueue".