I have a webapp that runs in the ROOT context of a Tomcat6 instance. I'd like to add a hawtio console to this webapp, accessible via a sub path. That is, I'd like http://myserver:8080
to still be my webapp, but http://myserver:8080/hawtio
to open up the hawtio console.
I'm aware that I can just copy over the hawtio.war
file to the $TOMCAT_HOME\webapps
and that'll get me pretty much there. Alas, I do NOT want to have to deploy two separate webapps but instead just deploy the one, and have hawtio come along for the ride.
I started by adding hawtio as a dependency in my pom.xml
like so:
<dependency>
<groupId>io.hawt</groupId>
<artifactId>hawtio-default-offline</artifactId>
<version>1.2.2</version>
<type>war</type>
</dependency>
Couple that with my assembly scripts and I have a war file that contains all of the necessary hawtio classes.
Next, I need to map the hawtio servlet to my subpath in the web.xml
. Maybe like so:
<servlet>
<servlet-name>HawtioServlet</servlet-name>
<servlet-class>THIS-IS-MY-QUESTION</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>HawtioServlet</servlet-name>
<url-pattern>/hawtio/*</url-pattern>
</servlet-mapping>
And that's where I need my question answered. What is the hawtio servlet class, that I can use in this case?
I see a bunch of hawtio servlets in the various hawtio packages, but all appear to be sub servlets and not the main one.
What am I missing?
combining hawtio with your WAR should work (providing there's no clashes with JS libraries, CSS, images or HTML files etc).
However the maven-war-plugin doesn't combine web.xml files if you depend on another WAR; so I'd recommend copying the web.xml from hawtio: https://github.com/hawtio/hawtio/blob/master/hawtio-web/src/main/webapp/WEB-INF/web.xml#L9 and adding your own stuff into it.
One day, when hawtio goes Servlet 3.0 - we'd use annotations and things would be much easier to combine; the downside is we're trying to make hawtio run everywhere; so we can't assume Servlet 3 any time soon