activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neduz <>
Subject Connection Refused from ActiveMQConnectionFactory
Date Wed, 27 Feb 2013 12:16:00 GMT

Since I upgraded from ActiveMQ 5.7.0 to 5.8.0 in Karaf 2.3.0, I had to
change the configuration for the setup of the embedded broker and the
ConnectionFactory service.
Previously I created the broker and the ConnectionFactory from the same
blueprint XML file, using the activemq xbean namespace.
Now the broker is created in a spring XML file (which was installed in the
KARAF_HOME/etc folder automatically). 

I use this blueprint xml to create a ConnectionFactory service:

<blueprint xmlns=""

    <ext:property-placeholder />

    <bean id="activemqConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory" >
        <property name="brokerURL"
value="tcp://localhost:61616?connectionTimeout=10000" />
		<property name="userName" value="****"/>
		<property name="password" value="****"/>

    <bean id="pooledConnectionFactory"
        <property name="maxConnections" value="50" />
        <property name="connectionFactory" ref="activemqConnectionFactory"

    <bean id="resourceManager"
          <property name="transactionManager" ref="transactionManager" />
          <property name="connectionFactory" ref="activemqConnectionFactory"
          <property name="resourceName" value="activemq.resourcemanager" />

    <reference id="transactionManager"
interface="javax.transaction.TransactionManager" />

    <service ref="pooledConnectionFactory"
            <entry key="name" value="amqCF-pool"/>


The result is that even though the Spring xml file has a lower start level
in Karaf, the connectionFactory service gets a "connection refused" when the
first bundle(s) tries to use the ConnectionFactory Service. When I restart
the failed bundles, they can connect and the system runs fine.

So the startlevel("default" broker) < startlevel(connection-factory.xml)<
startlevel(my bundles using the connection factory).

I tried the old blueprint-broker xml, but the namespace handler seems to be
lacking (can't find it in the Services tab on the karaf web console). I
cannot see an activemq-blueprint feature anymore (it's not listed in either).

I tried the "depends-on" attribute; but it seems blueprint can't see the
spring-id's in other bundles/xml files.

I also tried to play with the brokerUrl option "connectionTimeout", but the
Connection Refused keeps coming at startup. 

The only work around I can think of (but haven't tried yet) is to create a
"dummy bundle" with a start level between the broker and the connection
factory service and perform a thread.sleep in the startUp method, hoping
that the broker's threads have enough time to start before the
ActiveMQConnectionFactory is started.

I could also try to use spring-beans/spring-dm xml format to create the
connectionfactory bean and register the service, but as I was only using
blueprint so far, I'd like to stick to one standard for the whole

Does anyone have any suggestions how to get the ConnectionFactory service
running after the broker started?

Kind regards,

Tom Mercelis

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message