Enterprise Integration Zone is brought to you in partnership with:

Christian is a Principal Middleware Specialist/Architect at Red Hat specializing in developing enterprise software applications with an emphasis on software integration and messaging. His strengths include helping clients build software using industry best practices, Test Driven Design, ActiveMQ,Apache Camel, ServiceMix, Spring Framework, and most importantly, modeling complex domains so that they can be realized in software. He works primarily using Java and its many frameworks, but his favorite programming language is Python. He's in the midst of learning Scala and hopes to contribute to the Apache Apollo project. Christian is a DZone MVB and is not an employee of DZone and has posted 53 posts at DZone. You can read more from them at their website. View Full User Profile

Plugging the HawtIO Monitoring Webapp into a Stand-Alone ActiveMQ Instance

04.23.2013
| 5438 views |
  • submit to reddit
HawtIO is a new pluggable HTML5 dashboard for monitoring ActiveMQ, Camel, Karaf, Fuse Fabric, Tomcat, and other technologies. Actually, I was completely surprised to see the list of plugins already available and how HawtIO has already gained so much good traction. Not surprisingly though… it does some pretty cool stuff…

The purpose of this quick post is to help you plug HawtIO into your stand-alone ActiveMQ instances with minimal fuss. For production deployments, I would recommend using a hardened, production-ready version of ActiveMQ such as FuseMQ Enterprise, but some folks stick with the community versions and a standalone deployment. Let’s say you had the latest version of ActiveMQ and wanted to pop HawtIO into it to see how “hawt” it is.

First, HawtIO is a webapp packaged as a normal war file that can be deployed to any servlet container. This means you can deploy it, for example, to a Tomcat instance which has an embedded ActiveMQ along with some Camel routes, and HawtIO would discover and allow you to monitor all three technologies from the same dashboard. But like I said before, this post is more about the stand-alone deployments. The stand-alone ActiveMQ itself doesn’t run in a servlet container, but does contain an embedded Jetty server that it uses for its current web console. Basically, what we want to do is tell the embedded Jetty server to find the HawtIO war and load it up.

Start by downloading the HawtIO war and put it at your $ACTIVEMQ_HOME/hawtio folder (that folder won’t exist out of the box, you’ll have to create it).

Then edit the Jetty config file in $ACTIVEMQ_HOME/conf/jetty.xml

You’ll want to add the following WebAppContext to the handlers property:

<bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
        ...
        <property name="handler">
            <bean id="sec" class="org.eclipse.jetty.server.handler.HandlerCollection">
                <property name="handlers">
                    <list>
                        ...
                        <bean class="org.eclipse.jetty.webapp.WebAppContext">
                             <property name="contextPath" value="/hawtio" >
                            <property name="war" value="${activemq.home}/hawtio/hawtio-web-1.0.war" />
                            <property name="logUrlOnStart" value="true" >
                        </bean></p>
 
<p>

Next, we’ll need to tweak the contents of the hawtio war file because it will contain a conflicting slf4j jar that would normally already be on the classpath for ActiveMQ:

zip -d $ACTIVEMQ_HOME/hawtio/hawtio-web-1.0.war WEB-INF/lib/slf4j-api-1.6.1.jar

After that you should be good to go. Start ActiveMQ and Navigate your browser to http://localhost:8161/hawtio/

Then have fun hacking around!




Published at DZone with permission of Christian Posta, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)