HawtIO on JBoss EAP (Part II)
Join the DZone community and get the full member experience.Join For Free
i just posted an entry on running hawtio on jboss wildfly 8.1 recently. from that post you know how awesome hawtio is , and all of the cool plugins it has to make managing your jvm based technologies from a single dashboard… well… hawt ….
however, i wanted to dedicate a post to running hawtio on jboss eap for the same reasons outlined in the previous post:
as we at red hat roll out jboss fuse and jboss fuse serviceworks , we’re getting better at integrating the individual components. for example, a fuse service works subscription gives you full access to a-mq, fuse, and all of its components, including hawtio. unfortunately, hawtio isn’t “officially” supported in eap as of today, but that will be fixed in next releases. it’s not a limitation of the technology, it’s just there’s so much there and red hat has stringent testing/compatibility requirements so we need to have all of the testing/certification done before we “support it” fully.
but… there’s really no reason to not use it anyway (at least development and qa), while we wait for support. and there are lots of people already doing that. just remember, it’s not officially supported yet!
so the rest of this blog is a step-by-step guide with best practices for getting hawtio deployed and secured on your jboss eap 6.x application server. i will use hawtio 1.4.11 (latest release from the community) for this guide.
hawtio on jboss eap 6.1
this first section will discuss eap 6.1 because it seems to work great following the similar directions as those for deploying hawtio on wildfly 8.1 . basically, if you follow the instructions from the blog post on running on wildfly, you’ll get it working just fine . to be very specific do these pieces:
- remove the log4j.properties file to use eap logging subsystem
- rename distro to hawtio.war
- create users in applicationrealm with roles including “admin”
standalone.xmlfile to account for the following settings:
i’ve also added [these instructions to the hawtio documentation][http://hawt.io/getstarted/index.html] (the website should update with those changes soon).
hawtio on jboss eap 6.2
so unfortunately, getting hawtio to run on jboss eap 6.2 has some issues with jaas that i haven’t been able to figure out. if you’re a wildfly 7/eap 6.x wizard and wish to take a look have a peek at the github issue i have open .
thankfully, however, hawtio is quite versatile and doesn’t have to be run as a web-app collocated on the container you want to manage. you can run it standalone as a chrome extension or in a separate container that’s not jboss eap. effectively, you can use hawtio’s connect page to remotely connect to the container you wish to manage.
for example, download the standalone distribution of hawtio which ends up just being an executable jar. run it like this (make sure to add the params for the port change, because we don’t want to conflict with the eap ports if running on the same machine):
ceposta@postamachat(standalone) $ java -jar hawtio-app-1.4.11.jar --port 9091
this will bring up hawtio running standalone (with an internal jetty server! woohoo!).
then click the “connect” tab and you should see a page like this:
wait, what? just connect?
“how would this even work”" you ask? “how can we connect to eap and have hawtio just manage it?”
well, the magic is this totally awesome little library named jolokia .
jolokia provides rest access to your jmx tree. so the way to get hawtio to manage your jboss eap 6.2 container is to enable jolokia on it and then use hawtio’s connect tab to log in. if you haven’t taken a look at jolokia, you’re missing out!! no more complicated jmx api/clients and query/filter api. just use rest endpoints and curl. simple.
jolokia has a few options for deploying/enabling . the most straight forward is a web app, but you could also attach as a jvm agent at startup time. we’ll take the easy approach and deploy jolokia as a webapp:
for this blog post, i’m using jolokia 1.2.2. so when you download it, it has a name like this
. let’s rename the distro so we don’t take into account the version numbers to make it easier to get to the url:
ceposta@postamachat(rename) $ mv jolokia-war-1.2.2.war jolokia.war
enable security for jolokia
next, we want to enable security for the jolokia web app. we’ll do that as described in the jolokia documentation . we’ll need to edit the web.xml file that comes in the jolokia jar and uncomment the section that’s blocked out for security:
ceposta@postamachat(rename) $ vi jolokia.war
your config in web-inf/web.xml should have a security section like this:
163 <!-- 164 example configuration for switching on basic security. the role 'jolokia' 165 must be mapped to real users with passwords on the appserver side: 166 --> 167 <login-config> 168 <auth-method>basic</auth-method> 169 <realm-name>jolokia</realm-name> 170 </login-config> 171 172 <security-constraint> 173 <web-resource-collection> 174 <web-resource-name>jolokia-agent access</web-resource-name> 175 <url-pattern>/*</url-pattern> 176 </web-resource-collection> 177 <auth-constraint> 178 <role-name>jolokia</role-name> 179 </auth-constraint> 180 </security-constraint> 181 182 <security-role> 183 <role-name>jolokia</role-name> 184 </security-role> 185 186 </web-app>
now add a user like we did in the previous blog that has a role of “jolokia”. note, make sure this user is added to the applicationrealm.
connect to eap 6.2
now go back to your standalone hawtio (we deployed it in the previous step at http://localhost:9091/hawtio ) and enter the connect params (path as follows):
click “connect to remote server” and viola! you’re conencted.
where to go from here
you can also try to enable ssl over the http connection as well as maybe use digest auth instead of the default basic auth. i’ll leave that as an exercise for the reader
if you have any questions about hawtio , please
Published at DZone with permission of Christian Posta, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.