Friday, August 19, 2011

How to Enable ActiveMQ Web Console on ServiceMix 4.4

A few days ago I was helping an Apache user getting the ActiveMQ Web Console up and running on ServiceMix 4.4. At first instance, it seems to be a trivial setting but it's a little bit tricky.

Out of the box, every ServiceMix instance comes with an embedded ActiveMQ JMS (Java Message Service) broker. This feature makes it easy to communicate between Camel routes using persistent messages and also to distribute messages over multiple instances using clustering or load balancing.

The ActiveMQ Web Console feature is included  in any ActiveMQ distribution and you'll probably want to have it installed in ServiceMix as well to make sure you can monitor your JMS broker.

So, the first thing you have to do is to install the war feature running the following command:

karaf@root> features:install war


Then you can do run the following command to install the ActiveMQ Web Console:


karaf@root> features:install activemq-web-console 

This command will install and start the web console automatically with an embedded broker which you  can access going to the following URL: http://localhost:8181/activemqweb


But that brings the first issue... Once you have the default embedded ActiveMQ broker running then the Web Console will fail to start since it also tries to start an instance of the ActiveMQ basically on the same port number. It's quite frustrating to install a feature on ServiceMix and not be able to test it or execute it right away.

So, to configure the ActiveMQ Web Console to connect to the default embedded broker you have to do a little extra configuration change but that should be straightforward.

Go to $SMX_HOME/etc and edit the system.properties file then add the following details:


webconsole.type=properties
webconsole.jms.url=tcp://localhost:61616
webconsole.jmx.url=service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-root
webconsole.jmx.user=smx
webconsole.jmx.password=smx



Save it and (re)start ServiceMix. That should be enough to get the ActiveMQ Web Console connected to the default embedded broker in ServiceMix.

If you don't want to monitor the default embedded broker but want to stick with the instance that the Web Console starts for you then all you will have to do is to uninstall the default embedded ActiveMQ broker with the following command:


karaf@root> features:uninstall activemq-broker 

and then restart ServiceMix. This way there will be no conflicts on the ActiveMQ port number anymore.

I hope this helps to clarify some of the issues out there...

Enjoy the ride!

7 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. I follwed as you mentioned
    I changed the system.properties
    and

    features:install war

    then
    features:install activemq-web-console
    after this i am getting following error

    Error executing command: URL [mvn:org.apache.activemq/activemq-web-console/5.5.1
    /war?Webapp-Context=activemq-web-console] could not be resolved.


    please send me a solution as soon as possible
    shriman.nijagun@evolvussolutions.com

    ReplyDelete
  4. Hi,

    Thanks for the useful blog post. I had to add the "smx" user into users.properties, adding them to the "admin" group but otherwise it worked as advertised.

    J.

    ReplyDelete
  5. Hi Jabali, thanks very much.

    I followed your post and then found that....

    as for ServiceMix 4.5.1

    features:install war
    features:install activemq-web-console

    these two steps are OK for binding the web console with the default broker..

    ReplyDelete