AMQ-3121: Avoid connection creation while creating XAResource if the connection factory is not an xa connection factory
Avoid connection creation while creating XAResource if the connection factory is not xa connection factory, also, if it is xa connection, I think that the connection should not be closed as the new created xa resource holds reference to connection.
When an MDB EJB is deployed in Geronimo 2.1.7, some IOExceptions similar to the following are noticed:
2011-03-17 10:25:05,035 ERROR [TransportConnector] Could not accept connection from /127.0.0.1:48012: java.io.IOException: The transport is not running.
java.io.IOException: The transport is not running.
at org.apache.activemq.transport.TransportSupport.checkStarted (TransportSupport.java:103)
at org.apache.activemq.transport.tcp.TcpTransport.oneway (TcpTransport.java:117)
at org.apache.activemq.transport.InactivityMonitor.oneway (InactivityMonitor.java:145)
at org.apache.activemq.transport.TransportFilter.oneway (TransportFilter.java:80)
at org.apache.activemq.transport.WireFormatNegotiator.oneway (WireFormatNegotiator.java:93)
at org.apache.activemq.transport.MutexTransport.oneway (MutexTransport.java:47)
at org.apache.activemq.broker.TransportConnection.dispatch (TransportConnection.java:1138)
at org.apache.activemq.broker.TransportConnection.start (TransportConnection.java:885)
at org.apache.activemq.broker.TransportConnector$1.onAccept (TransportConnector.java:148)
at org.apache.activemq.transport.tcp.TcpTransportServer.run (TcpTransportServer.java:162)
This is because the connection used to create xa resources is closed immediately. A fix
AMQ-3121-v412.patch (https://issues.apache.org/jira/secure/attachment/12478376/AMQ-3121-v412.patch) has been posted to AMQ JIRA. The issue is resolved by
(1) creating the connection only when the factory is XA and
(2) caching the connection used to create xa resources and closing it when the resource adapter is stopped.
This Geronimo JIRA is created to merge
AMQ-3121 into our private build of AMQ and track the issue.