activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rranjan <>
Subject Embedding activeMQ stops automatically
Date Wed, 09 Sep 2009 21:59:27 GMT

I have a basic requirement that I am struggling with for the last 3 days.

I want to create a zip file which contains the required Jar files from my
application and the activeMQ jars. I want activeMQ to be embedded into my

In order to do this I followed the instructions and created a spring
configuration that looks as below.
<bean id="broker" class="org.apache.activemq.xbean.BrokerFactoryBean">
    <property name="config" value="classpath:activemq.xml" />
    <property name="start" value="true" />

I have a basic Java class with a main method that loads the spring config.
The main method has a single line.
ApplicationContext context = new

In my activeMQ.xml I provided the basic needs of my app and it looks as

    <!-- Allows us to use system properties as variables in this
configuration file -->
         <property name="locations">
    <broker xmlns=""
brokerName="localhost"  dataDirectory="${home}/data" >
        <!-- Destination specific policies using destination names or
wildcards -->
                    <policyEntry queue=">" memoryLimit="5mb"/>
                    <policyEntry topic=">" memoryLimit="5mb">
                      <!-- you can add other policies too such as these

        <!-- Use the following to configure how ActiveMQ is exposed in JMX
            <managementContext createConnector="false"/>

            <amqPersistenceAdapter syncOnWrite="false"
directory="${home}/data" maxFileLength="20 mb"/>

        <!--  The maximum about of space the broker will use before slowing
down producers -->
                    <memoryUsage limit="20 mb"/>
                    <storeUsage limit="1 gb" name="foo"/>
                    <tempUsage limit="100 mb"/>
        <!-- The transport connectors ActiveMQ will listen to -->
            <transportConnector name="openwire" uri="tcp://localhost:61616"
<!-- END SNIPPET: example -->

When I start my app I see that the activeMQ server is started but it shuts
down immediately.
2009-09-09 14:56:44,830 [MQ ShutdownHook] INFO  BrokerService                 
- ActiveMQ Message Broker (localhost, is shutting down
2009-09-09 14:56:44,834 [MQ ShutdownHook] DEBUG BrokerService                 
- Caught exception, must be shutting down: java.lang.IllegalStateException:
Shutdown in progress

I'm assuming someone send a kill message or a stop request. 

I modified my Java startup class to the following to keep the thread alive.
ApplicationContext context = new
		boolean shouldRun = true;
		while (shouldRun){
			try {
			} catch (InterruptedException e) {
				shouldRun = false;

I see that now activeMQ happily starts up.

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

View raw message