I've tried this test case against SVN HEAD and it works perfectly for me.
The strack trace you got is only ever created when a broker receives a
start connection with a clientID which is already connected to the
broker (as it is against the JMS spec to allow 2 clients with the same
ID to be connected at once).
The test case you supply only creates one connection and does not
specify a clientID (so we auto-generate a unique one for each
connection). So I doubt its possible for this test case to fail - I
suspect its something else really causing your problem with Spring.
e.g. is your spring code trying to create 2 connections with the same
client ID? Does the spring code specify a clientID (via
Connection.setClientID())?
On 4/28/06, Craig Day <[EMAIL PROTECTED]> wrote:
While using the new Spring-2.0 DefaultMessageListenerContainer I can
reliably reproduce the following exception on the broker side which
usually results in a hang on the client side:
The broker logs the following exception:
INFO Service - Sync error occurred:
javax.jms.InvalidClientIDException: Broker: localhost - Client:
ID:inspiron-1410-114619274
7453-2:1 already connected
javax.jms.InvalidClientIDException: Broker: localhost - Client:
ID:inspiron-1410-1146192747453-2:1 already connected
at
org.apache.activemq.broker.region.RegionBroker.addConnection(RegionBroke
r.java:154)
at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:
65)
at
org.apache.activemq.advisory.AdvisoryBroker.addConnection(AdvisoryBroker
.java:69)
at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:
65)
at
org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrok
erFilter.java:77)
at
org.apache.activemq.broker.AbstractConnection.processAddConnection(Abstr
actConnection.java:500)
at
org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConn
ection(ManagedTransportConnection.java:82)
at
org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:106
)
at
org.apache.activemq.broker.AbstractConnection.service(AbstractConnection
.java:196)
at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConn
ection.java:62)
at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorre
lator.java:93)
at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.
java:70)
at
org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatN
egotiator.java:114)
at
org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMoni
tor.java:122)
at
org.apache.activemq.transport.TransportSupport.doConsume(TransportSuppor
t.java:87)
at
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:139
)
at java.lang.Thread.run(Thread.java:595)
I have extrapolated the sequence of calls that
DefaultMessageListenerContainer is making and managed to produce a
simple test case that reproduces the problem:
import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQQueue;
import javax.jms.*;
public class TestActiveMQ extends TestCase {
public void testConnectionFactory() throws Exception {
final ActiveMQConnectionFactory cf = new
ActiveMQConnectionFactory("tcp://localhost:61616");
final ActiveMQQueue queue = new ActiveMQQueue("testqueue");
final Connection conn = cf.createConnection();
Runnable r = new Runnable() {
public void run() {
try {
Session session = conn.createSession(false, 1);
MessageConsumer consumer =
session.createConsumer(queue, null);
Message msg = consumer.receive(1000);
} catch (JMSException e) {
e.printStackTrace();
}
}
};
new Thread(r).start();
conn.start();
try {
synchronized (this) {
wait(3000);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Let us know if you need anymore information. Dont want to scrub ActiveMQ
from my list of candidates If I can help it.
cheers
craig
------------------------------------------------------------------------------------------------------------------------------
This e-mail and any files transmitted with it are confidential and are only for
the use of the person to whom they are addressed. If you are not the intended
recipient, you are hereby notified that any use, dissemination, forwarding,
printing, copying or dealing in any way whatsoever with this e-mail is strictly
prohibited. If you have received this e-mail in error, please reply to us
immediately and delete the document.
It is the recipient's duty to virus-scan and otherwise test the enclosed
information before using the information or loading attached files onto any
computer system. JDV Limited does not warrant that the information contained in
this e-mail is free from viruses, defects, errors, interception or interference.
JDV Limited, and each of its related companies each reserve the right to
monitor all e-mail communications through its networks.
Any views expressed in this message are those of the individual sender, except
where that sender specifically states them to be the views of JDV Limited.
Your private information is only used and disclosed for the intention which you
have provided it for. This information is not disclosed or used unless your
consent has been provided or in the case that JDV Limited is permitted to do so
under the Privacy Act of 1988.
-----------------------------------------------------------------------------------------------------------------------------
--
James
-------
http://radio.weblogs.com/0112098/