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
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Building Intelligent Multi-Agent Systems With OpenAI’s Swarm

Trending

  • Mastering Advanced Traffic Management in Multi-Cloud Kubernetes: Scaling With Multiple Istio Ingress Gateways
  • How to Format Articles for DZone
  • Develop a Reverse Proxy With Caching in Go
  • Enhancing Security With ZTNA in Hybrid and Multi-Cloud Deployments

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.0K 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, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Building Intelligent Multi-Agent Systems With OpenAI’s Swarm

Partner Resources

×

Comments
Oops! Something Went Wrong

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

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!