Auto-Start Apache ActiveMQ 5.4.2 with Apache Tomcat 6.0.30

I could not get any helpful information, how to auto-start ActiveMQ broker from Tomcat. And thus, I finally, after 4 fruitful hours, configured.

This is my valuable contribution to open-source community.

Step 1

Install ActiveMQ and Tomcat from following places, and

Also download activemq web console for autostarting activemq instance from tomcat.

Step 2

Copy “activemq-all-5.4.2.jar” from activemq\lib to tomcat\lib

Copy “activemq-web-console-5.4.2.war” inside tomcat webapps

Step 3

Configure %CATALINA_HOME%\bin\catalina.bat or .sh by adding the following line

set JAVA_OPTS=”-Dwebconsole.jms.url=tcp://localhost:61616 -Dwebconsole.type=properties”

Step 4

If you have already set the java, catalina and activemq path variable then you can start the tomcat service from the console as,


Step 5

Enter the following on the browser address bar,



ActiveMQ Web Console


If someone needs further information, I’m happy to help.

Open-Source community rocks !!!


19 thoughts on “Auto-Start Apache ActiveMQ 5.4.2 with Apache Tomcat 6.0.30”

  1. Hello, Iam a beginner with JMS, I’m trying to make a Hello World App, a chat. I followed all directions for install activemq, and included a new topic in the configuration page.
    But I have a problem getting the JNDI.
    I am going to include the sourse and error text.


    public class ClienteJMSChat implements javax.jms.MessageListener {

    private static final String CONTEXT_FACTORY =

    /**:::: I think the problem here could be ::::::::::::::::::*/
    protected static final String PROVIDER_URL = “tcp://localhost:61616″;

    /** this is the name of the topic created by me */
    protected static final String TOPIC_CONNECTION_FACTORY =”Friki”;

    public void initialize(String topico, String usuario, String password) {

    debug(“Cargando configuración…”);
    Properties properties = new Properties();

    properties.put(Context.PROVIDER_URL, PROVIDER_URL);

    try {
    debug(“obtaining the initial context… the excecution collapse after this line”);
    InitialContext context = new InitialContext(properties);

    TopicConnectionFactory conFactory = (TopicConnectionFactory) context

    TopicConnection conexion = conFactory.createTopicConnection(
    usuario, password);

    TopicSession sesionP = conexion.createTopicSession(false,
    TopicSession sesionS = conexion.createTopicSession(false,

    Topic topicObj = (Topic) context.lookup(topico);

    TopicSubscriber suscriptor = sesionS.createSubscriber(topicObj);
    TopicPublisher publicador = sesionP.createPublisher(topicObj);


    this.conexion = conexion;
    this.sesionP = sesionP;
    this.sesionS = sesionS;
    this.publicador = publicador;
    this.usuario = usuario;


    } catch (NamingException ne) {
    throw new RuntimeException(“Error JNDI”, ne);

    } catch (JMSException jmse) {
    throw new RuntimeException(“Error JMS”, jmse);


    Error text:
    Exception in thread “main” java.lang.RuntimeException: Error JNDI
    at jms_test.ClienteJMSChat.initialize(
    at jms_test.ClienteJMSChat.main(
    Caused by: javax.naming.NamingException: Operation getNameParser failed: invalid stream header: 01416374
    at org.exolab.jms.jndi.mipc.NameServiceProxy.checkReply(
    at org.exolab.jms.jndi.mipc.NameServiceProxy.getNameParser(
    at org.exolab.jms.jndi.mipc.IpcJndiInitialContextFactory.getInitialContext(
    at org.exolab.jms.jndi.InitialContextFactory.getInitialContext(
    at javax.naming.spi.NamingManager.getInitialContext(
    at javax.naming.InitialContext.getDefaultInitCtx(
    at javax.naming.InitialContext.init(
    at javax.naming.InitialContext.(
    at jms_test.ClienteJMSChat.initialize(

  2. Great info. However how do you configure the
    the transport connectors to expose ActiveMQ over a given protocol to remote clients and other brokers that was configured in the activemq.xml file:

  3. I followed the steps to deploy ActiveMQ war and then tried to start Tomcat server and getting the following exception. Do you have any idea to resolve the issue?
    Apr 18, 2011 5:23:00 PM org.apache.catalina.core.StandardContext loadOnStartup
    SEVERE: Servlet /activemq-web-console-5.4.2 threw load() exception
    javax.servlet.ServletException: Servlet.init() for servlet dispatcher threw exce
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
    at org.apache.catalina.core.StandardWrapper.load(
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
    at org.apache.catalina.core.StandardContext.start(
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
    at org.apache.catalina.core.ContainerBase.addChild(
    at org.apache.catalina.core.StandardHost.addChild(

    at org.apache.catalina.startup.HostConfig.deployWAR(

    at org.apache.catalina.startup.HostConfig.deployWARs(
    at org.apache.catalina.startup.HostConfig.deployApps(
    at org.apache.catalina.startup.HostConfig.start(
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl

  4. Hi,
    Thanks for info provided above.
    When i try to build using gradle i am getting this error.
    Could not find group:net.sf.josql, module:josql, version:1.5.

    Can you please help me to get rid of this error.

  5. Hi,
    Thanks for the above valuable info. I was stuck with this for more than a week and fed up with the task am doing. Finally your post helped me regain my energy. thanks a lot.

  6. Oh my goodness! Incredible article dude! Many thanks,
    However I am experiencing difficulties with your RSS. I don’t know
    why I cannot subscribe to it. Is there anybody getting
    identical RSS issues? Anyone that knows the solution will you kindly respond?

  7. Admiring the persistence you put into your blog and detailed information you present.
    It’s great to come across a blog every once in a while that isn’t the same unwanted rehashed
    material. Great read! I’ve bookmarked your site and I’m including your
    RSS feeds to my Google account.

  8. I read this article completely regarding the comparison of most recent and preceding technologies,
    it’s remarkable article.

  9. I don’t even know the way I finished up here, but I assumed this post was good.
    I do not recognize who you’re however certainly you’re going to a well-known blogger if you happen to aren’t
    already. Cheers!

  10. I have been explorihg for a little for any high quality articles or webloog posts in this kind of house .

    Explokring in Yahoo I eventually stumbled upon this site.
    Reading thuis info So i’m happy to express
    that I’ve an incredibly excellent uncanny feeling
    I came upon just what I needed. I most certainly will make certain to don?t overlook this site and give it a lance regularly.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s