Child pages
  • Initial Configuration
Skip to end of metadata
Go to start of metadata

Initial Configuration

Document Organization

Firstly you need to add the jars to your classpath.

Required JARs

To make ActiveMQ easy to use, the default activemq-all.jar comes complete with all the libraries required. If you prefer to have explicit control over all the jars used by ActiveMQ here is the full list of individual jars required

  • activemq-broker.jar
  • activemq-client.jar
  • activeio-core.jar
  • activemq-kahadb-store.jar (if you wish to use persistence)
  • slf4j-api.jar
  • J2EE APIs which could be the j2ee.jar from Sun or your J2EE container or you could use Geronimo's freely distributable geronimo-spec-j2ee.jar. If you are inside a servlet container and being dependent on the j2ee.jar causes you troubles, the parts of the J2EE jar we are dependent on are as follows...
    • geronimo-spec-jms.jar
    • geronimo-spec-jta.jar
    • geronimo-spec-j2ee-management.jar

If you want to grab a J2EE specification jar we recommend the Apache repository

Optional JARS

  • spring.jar - if you wish to use the XML configuration file for configuring the Message Broker
  • if you wish to use message persistence then you need to add a persistent jar to your classpath (see below). If you just want a lightweight message bus with no durability you can leave this step out but we highly recommend persistence for production deployments.

Persistence Support

We support persistence via Specialized KahaDB file system message store or JDBC. For full explict control over configuration check out the Xml Configuration. If you wish to use KahaDB, include kahadb.jar in your classpath. In case of JDBC you'll need to include appropriate database driver.

If you're just doing some testing or in-VM SEDA based messaging you may wish to disable persistence. You can use the Xml Configuration for this.

In 5.x you can do this by setting the persistent=false property to false either in the Xml Configuration or on the broker URL.

Next steps

One of the first things you might want to do is start a broker. Once you have a broker running you could try some example programs

If you want to write your own application, you can just instantiate an ActiveMQConnectionFactory, configure its properties directly and then you're ready to use the standard JMS API to create Connections, Sessions, MessageProducer and MessageConsumer instances.

You can also take a look at our unit tests for more examples on how to use ActiveMQ.

Additional Resources

Related Reading


Related open source projects

  • Apache Camel
  • Apache Geronimo
  • Hermes JMS
  • Stomp is an open wire protocol (similar to HTTP) for communicating with MOMs from different languages. It has clients for languages like C, C#, Python, Perl, Ruby etc.
  • XBean is used as the default XML configuration mechanism for ActiveMQ
  • No labels


  1. The link to the ActiveMQConnectionFactory un Next Steps should is currently pointing to the AMQ 3.x version. This should be changed or a link to the AMQ 4.x version be added :

    Under Optional JARS, the item

    • if you want to use Zeroconf based discovery then you need the jmdns.jar

    should be marked as specific for AMQ 3.x

  2. ActiveMQ 4.0 Jars Files

    Required Jars:

    • activeio, backport-util-concurrent, commons-logging, geronimo-spec-j2ee-management, geronimo-spec-jms, mx4j.

    Optional Jars:

    • activemqcluster, activemqsoap, commons-beanutils, commons-collections, commons-dbcp, commons-httpclient, commons-pool, derby, geronimo-spec-j2ee-connector, jmdns, jrms, org.mortbay.jetty, xmlpull, xstream,