activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "matt hoffman" <>
Subject Help with embedded brokers
Date Thu, 01 May 2008 15:29:49 GMT
I'm having a lot of trouble getting embedded brokers to work as they
should.  I'm using them in my case mainly to ease configuration -- I want to
be able to run several instances of the same code and have them discover
each other and communicate, without needing a single server already running.

The current problem is, the first server starts up great, and works as
expected.  Subsequent servers, though, throw this error:

javax.jms.InvalidClientIDException: Broker: localhost - Client:
NC_localhost_inboundlocalhost already connected from vm://localhost#0

Which seems strange, seeing as how I'm not explicitly setting clientID
anywhere.  I thought these were auto-generated?

Below is the configuration I'm currently using.  I'm not referencing the
broker in code at all; I'm interacting with it only through the Spring
JmsTemplate, which in turn gets a connection from the
ActiveMQConnectionFactory connecting to vm://localhost.  Based on the
documentation, that seems to be the way to do it... what have I

In my Spring config:

    <bean id="broker" class="org.apache.activemq.xbean.BrokerFactoryBean">
        <property name="config" value="classpath:activemq.xml" />
        <property name="start" value="true" />

    <bean id="workQueueDestination"
        <constructor-arg index="0" value="Test.WorkQueue"/>

    <bean id="eventTopicDestination"
        <constructor-arg index="0" value="Test.EventTopic"/>

    <bean id="jmsFactory"
class="org.apache.activemq.ActiveMQConnectionFactory" depends-on="broker">
        <property name="brokerURL" value="vm://localhost"/>

    <bean id="workQueueJmsTemplate"
        <property name="connectionFactory">
            <!-- wrapping in a pool to avoid creating a connection per send
                <property name="targetConnectionFactory">
                    <ref local="jmsFactory"/>

        <property name="defaultDestination" ref="workQueueDestination"/>

I previously tried including the broker config directly in the Spring file,
but broke it out as a problem-solving exercise and haven't moved it back
Here's the referenced activemq.xml:

<beans xmlns=""

    <jms:broker id="broker" persistent="false" useJmx="true">
            <jms:networkConnector uri="multicast://default" duplex="true"/>
            <!-- by default just auto discover the other brokers -->


            <jms:transportConnector name="openwire" uri="tcp://localhost:0"



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message