DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Building Framework-Agnostic AI Swarms: Compare LangGraph, Strands, and OpenAI Swarm
  • Building Intelligent Multi-Agent Systems With OpenAI’s Swarm

Trending

  • How to Submit a Post to DZone
  • Architectural Collapse: How Extension Poisoning, Node Vulnerabilities, and Infrastructure Fog Enabled the GitHub Repository Breach
  • Connect Existing Data to AI Retrieval: How to Build Production-Ready Search Without Rebuilding Core Systems
  • The New Insider Threat Isn't Human: Securing AI Agents Before They Secure Themselves

JMX Over the Web With Jolokia and Hawtio

Jolokia and Hawtio gives Java developers a powerful way to monitor and manage their Java applications over the web.

By 
Matthew Casperson user avatar
Matthew Casperson
·
Oct. 21, 16 · Tutorial
Likes (6)
Comment
Save
Tweet
Share
26.4K Views

Join the DZone community and get the full member experience.

Join For Free

JMX provides Java developers with a powerful set of tools for monitoring and managing their applications. Any developer who has had to dig into the memory usage of their web server or diagnose database connections will have dusted off their copy of jconsole and Googled the default JMX port to try and see what is going on.

But having to connect to JMX over a custom port and protocol can be cumbersome in the real world. I suspect many of those developers who have tried to debug their production servers with JMX quickly found out that corporate firewalls prevented accesses, and the ops guys had blank stares when asked to open up JMX ports. Today everything is done via HTTP and RESTful interfaces, so wouldn’t it be great if you could access JMX via HTTP?

This is where Jolokia comes in. Jolokia is a JMX-HTTP bridge, exposing the power of JMX via a standard RESTful interface that is much easier to consume.

To demonstrate how Jolokia makes JMX easy, I will show you how to quickly combine two JBoss projects: WildFly Swarm and Hawtio.

WildFly Swarm is a standalone version of the popular WildFly Java EE server that provides a number of useful additions above the Java EE spec. Jolokia is one such extension. To build a WildFly Swarm package that includes Jolokia, all you need to do is visit the Swarm Generator, select Jolokia from the list of dependencies, download and extract the generated ZIP file, and build and run it with the Maven command mvn wildfly-swarm:run.

Screen Shot 2016-10-20 at 5.39.10 pm.png

You can confirm that Jolokia is running but opening http://localhost:8080/jolokia in a browser.

Screen Shot 2016-10-20 at 5.40.53 pm.png

The JSON response means that WildFly Swarm is up and running, and that the Jolokia dependency is exposing JMX over HTTP. Which is great, but this JSON is pretty hard to read in its raw form. This is where Hawtio comes in.

To get a copy of Hawtio running, download the standalone JAR file from the Hawtio website and run it with the command java -jar hawtio-app-1.4.66.jar --port 8090. Once Hawtio is started, you can access the dashboard via http://localhost:8090/hawtio.

At this point, you can connect Hawtio to the instance of Jolokia hosted by WildFly Swarm.

Screen Shot 2016-10-20 at 5.30.48 pm.png

And just like that, you have a fully interactive web-based dashboard that allows you to interact with all the JMX interfaces exposed by your web server.

Screen Shot 2016-10-20 at 5.45.32 pm.png

Of course, JMX is about more than just reporting the state of your application; you can also configure your system at runtime, with most enterprise libraries exposing an incredible amount of functionality via JMX operations.

Screen Shot 2016-10-20 at 5.47.35 pm.png

Jolokia and Hawtio are excellent additions to any Java developer's toolbox, providing a wealth of information and functionality via easy to access web dashboards.

swarm

Published at DZone with permission of Matthew Casperson. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Building Framework-Agnostic AI Swarms: Compare LangGraph, Strands, and OpenAI Swarm
  • Building Intelligent Multi-Agent Systems With OpenAI’s Swarm

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook