Hello, I have recently updated to OpenEJB 3.1.4 and i have a strange error
when sending jms messages (I don't know if the error is in ActiveMQ 5.3.1).
I will explain my environment.
I have a stateless bean with the following resources:
@Resource(mappedName="GRM_JMS_CF")
protected ConnectionFactory connectionFactory;
@Resource(mappedName = "queue/GRMWorkflow")
protected Queue queue;
and then, I have a method that sends messages to the queue:
Connection connection = null;
Session session = null;
MessageProducer producer = null;
try{
logger.debug("CF: " + connectionFactory);
connection = connectionFactory.createConnection();
session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
logger.debug("Cola: " + queue.getQueueName());
producer = session.createProducer(queue);
MapMessage request = session.createMapMessage();
...(code to fill the map)...
logger.debug("Enviando mensaje: " + request);
producer.send(request);
logger.debug("Enviado mensaje: " + request);
} catch (Exception e) {
logger.error("Error enviando mensaje: ", e);
throw e;
} finally{
if(producer != null) {
try {
producer.close();
} catch (JMSException e) {
logger.warn("Error al cerrar
producer: ", e);
}
}
if(session != null) {
try {
session.close();
} catch (JMSException e) {
logger.warn("Error al cerrar sesión:
", e);
}
}
if(connection != null) {
try {
connection.close();
} catch (JMSException e) {
logger.warn("Error al cerrar
conexión: ", e);
}
}
}
Then, the previous code is executed (it also executes other things that
don't matter in the error) by a thread pool that has defined a timeout to
avoid running out of threads due to unexpected error (for example, a
infinite loop).
So, I put a small timeout and launched a lot of executions to test how it
works all with new version with high load and I got that some threads where
interrupted while creating the connection:
2011-01-11 01:10:48,070 WARN "Transaction": Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@66d76a,
errorCode: -7
javax.transaction.xa.XAException: java.io.InterruptedIOException
at
org.apache.activemq.TransactionContext.toXAException(TransactionContext.java:697)
at
org.apache.activemq.TransactionContext.setXid(TransactionContext.java:607)
....
at
org.apache.geronimo.connector.outbound.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:87)
at
org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:94)
at
org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:67)
at
es.tid.geremias.workflow.invokers.GRMInvokerJMSBase.sendMessage(GRMInvokerJMSBase.java:44)
....
Caused by: javax.jms.JMSException: java.io.InterruptedIOException
at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1284)
at
org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1368)
at
org.apache.activemq.TransactionContext.setXid(TransactionContext.java:605)
... 66 more
Caused by: java.io.InterruptedIOException
at
org.apache.activemq.transport.vm.VMTransport.oneway(VMTransport.java:105)
at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:40)
at
org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:81)
at
org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:86)
at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1262)
... 68 more
Caused by: java.lang.InterruptedException
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1199)
at
java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:312)
at
java.util.concurrent.LinkedBlockingQueue.put(LinkedBlockingQueue.java:294)
at
org.apache.activemq.transport.vm.VMTransport.oneway(VMTransport.java:95)
... 72 more
and after that, appear some times the following error. I think my code is
correct, I close the connection in a finally block, so It shouldn't happen.
Maybe the connection is created before the interruptedexception but not
freed?:
2011-01-11 01:11:38,184 WARN "Transaction": Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@1ab51b0,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-24:0 already connected from vm://localhost#42
at
org.apache.activemq.TransactionContext.toXAException(TransactionContext.java:697)
...
at
org.apache.geronimo.connector.outbound.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:87)
at
org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:94)
at
org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:67)
at
es.tid.geremias.workflow.invokers.GRMInvokerJMSBase.sendMessage(GRMInvokerJMSBase.java:44)
...
Caused by: javax.jms.InvalidClientIDException: Broker: localhost - Client:
ID:jde-50093-1294698342634-24:0 already connected from vm://localhost#42
at
org.apache.activemq.broker.region.RegionBroker.addConnection(RegionBroker.java:216)
at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:82)
at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:82)
at
org.apache.activemq.advisory.AdvisoryBroker.addConnection(AdvisoryBroker.java:77)
at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:82)
at
org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:89)
at
org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:676)
at
org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:134)
at
org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:300)
at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178)
at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116)
at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
at
org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:210)
at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
... 3 more
Finally, I put all the errors it appeared to me. There are two kind of
errors, the interrupted errors due to timeout and already connected ones.
2011-01-11 01:10:48,070 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@66d76a,
errorCode: -7
javax.transaction.xa.XAException: java.io.InterruptedIOException
2011-01-11 01:10:48,070 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@87c6e,
errorCode: -7
javax.transaction.xa.XAException: java.io.InterruptedIOException
2011-01-11 01:10:48,070 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@5e1897,
errorCode: -7
javax.transaction.xa.XAException: java.io.InterruptedIOException
2011-01-11 01:11:15,305 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@1ab51b0,
errorCode: -7
javax.transaction.xa.XAException: Interrupted.
2011-01-11 01:11:15,272 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@18359aa,
errorCode: -7
javax.transaction.xa.XAException: Interrupted.
2011-01-11 01:11:38,184 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@1ab51b0,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-24:0 already connected from vm://localhost#42
2011-01-11 01:12:51,289 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@1ab51b0,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-24:0 already connected from vm://localhost#42
2011-01-11 01:12:53,406 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@1896b8d,
errorCode: -7
javax.transaction.xa.XAException: Interrupted.
2011-01-11 01:12:53,638 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@87c6e,
errorCode: -7
javax.transaction.xa.XAException: Interrupted.
2011-01-11 01:13:27,357 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@1ab51b0,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-24:0 already connected from vm://localhost#42
2011-01-11 01:13:47,448 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@1ab51b0,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-24:0 already connected from vm://localhost#42
2011-01-11 01:13:50,684 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@1ab51b0,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-24:0 already connected from vm://localhost#42
2011-01-11 01:14:28,551 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@1ab51b0,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-24:0 already connected from vm://localhost#42
2011-01-11 01:15:12,818 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@1ab51b0,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-24:0 already connected from vm://localhost#42
2011-01-11 01:36:31,224 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@9adbb8,
errorCode: -7
javax.transaction.xa.XAException: Interrupted.
2011-01-11 01:36:35,886 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@9adbb8,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-18:0 already connected from vm://localhost#30
2011-01-11 01:36:40,985 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@9adbb8,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-18:0 already connected from vm://localhost#30
2011-01-11 01:36:42,794 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@9adbb8,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-18:0 already connected from vm://localhost#30
2011-01-11 01:40:38,729 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@9adbb8,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-18:0 already connected from vm://localhost#30
2011-01-11 01:50:27,390 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@9adbb8,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-18:0 already connected from vm://localhost#30
2011-01-11 01:58:55,548 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@9adbb8,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-18:0 already connected from vm://localhost#30
2011-01-11 02:07:39,854 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@9adbb8,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-18:0 already connected from vm://localhost#30
2011-01-11 02:15:49,837 WARN Transaction Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@9adbb8,
errorCode: -7
javax.transaction.xa.XAException: Broker: localhost - Client:
ID:jde-50093-1294698342634-18:0 already connected from vm://localhost#30
--
View this message in context:
http://openejb.979440.n4.nabble.com/Error-sending-JMS-messages-when-client-previously-interrupted-tp3208926p3208926.html
Sent from the OpenEJB User mailing list archive at Nabble.com.