What’s Really Going On in Your Quarkus App? A Java Developer’s Guide to Jolokia and Hawtio
Learn how to peek inside the JVM, monitor real-time behavior, and explore live metrics with Jolokia, Hawtio, and Micrometer: All from your Quarkus application.
Java developers love building things, but when systems get serious, observability becomes just as important as business logic. Today, we are going to explore a very practical and lightweight way to peek inside your Quarkus application using Jolokia, Hawtio, and Micrometer.
If you have never heard of them, Jolokia is a JMX-HTTP bridge that exposes JMX MBeans over a REST API. Hawtio is a powerful, web-based console that connects to Jolokia endpoints and lets you browse, monitor, and even interact with your application's internals. Micrometer adds structured metrics that expose valuable runtime information. Together, they form a lightweight but powerful observability toolkit for Java applications.
Let’s get you up and running.
Setting up Jolokia in a Quarkus Application
First, we need a Quarkus project. If you already have one, feel free to follow along. Otherwise, create a quick example:
mvn io.quarkus.platform:quarkus-maven-plugin:3.10.1:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=jolokia-demo \
-Dextensions="rest"
cd jolokia-demo
Now, add Jolokia to your project. The easiest way is by adding the quarkus-jolokia extension:
quarkus ext add org.apache.camel.quarkus:camel-quarkus-jolokia
That is it. You now have Jolokia enabled by default in your application.
To confirm, start the application:
quarkus dev
Then navigate to:
http://0.0.0.0:8080/q/jolokia
You will see a giant JSON output listing all available MBeans.
Understanding MBeans: What You Are Actually Seeing
JMX (Java Management Extensions) exposes managed beans, or MBeans, that let you monitor and interact with the running application. Some MBeans are standard for every Java application. Others are specific to frameworks like Quarkus, or to your own custom code.
A few very interesting ones you will notice immediately:
java.lang:type=Memory
Shows detailed memory usage. You can check heap and non-heap memory, pools like Eden Space or Old Gen, and trigger garbage collection if needed.java.lang:type=Threading
Lists all thread counts and states. You can detect deadlocks or thread pool starvation if your application behaves strangely under load.java.lang:type=GarbageCollector,name=G1 Young Generation
If you are using G1GC, you can monitor how often minor and major collections happen.quarkus.info:type=Info
This MBean is a hidden gem. It exposes build information like git commit hashes, Quarkus version, and custom metadata.
These MBeans provide a real-time connection to how your application behaves without adding extra code.
Setting Up Hawtio the Quarkus Way
While you can run Hawtio as a separate application, there is an even better approach for Quarkus developers. Hawtio provides a Quarkus extension that embeds the console directly inside your application. No need to launch another process or configure external connections.
Add io.hawt:hawtio-quarkus and the supporting Camel Quarkus extensions to the dependencies in pom.xml (replace 4.x.y with the latest Hawtio release version):
<dependency>
<groupId>io.hawt</groupId>
<artifactId>hawtio-quarkus</artifactId>
<version>4.x.y</version>
</dependency>
Also make sure to disable hawtio security for now in the application.properties:
quarkus.hawtio.authenticationEnabled=false
When you restart your Quarkus application, Hawtio will now be available at:
http://localhost:8080/hawtio
The embedded Hawtio connects internally to the Jolokia endpoint that Quarkus already exposes.
Inside Hawtio, you can immediately browse:
Runtime details
Memory usage graphs
Active threads and thread dumps
All available MBeans
Application information
It feels almost magical. Your Quarkus app becomes self-explaining and self-monitoring, right out of the box.
Exploring Hawtio in Action
Inside Hawtio, click around the MBean browser to see the different sections.
Under java.lang:type=Memory
, you can observe your memory pools live and even trigger garbage collection. Under java.lang:type=Threading
, you can monitor thread activity or detect deadlocks if needed.
You can also invoke MBean operations with a single click or inspect live values that normally hide deep inside your running JVM.
If you added a custom MBean, such as a live configuration switch or cache reset control, you can manage it interactively without writing special APIs.
Going Further: Adding Micrometer Metrics to the Mix
Now that you have Jolokia and Hawtio set up, you might be wondering how to get even more useful information about your application's behavior. This is where the Micrometer extension comes into play.
Add it to your project:
quarkus extension add quarkus-micrometer
You will also need the JMX registry for micrometer:
quarkus ext add micrometer-registry-jmx
Inside Hawtio, open the Metrics tab. You will find metrics organized into:
Gauge: Represents a value that can go up or down, such as memory usage or current queue size, and is sampled at the time of observation.
Histogram: Collects observations into configurable buckets to analyze the distribution of values, useful for understanding metrics like response sizes or latencies.
Meter: A general term in Micrometer for any metric instrument; specific types include counters, gauges, timers, and distribution summaries, each serving different monitoring purposes.
Timer: Measures both the count and total duration of events, such as HTTP request handling times, providing insights into application performance.
For example, adding a simple custom counter would result in a Meter entry:
@Path("/hello")
public class HelloResource {
@GET
@Counted(value = "counted.method", extraTags = { "extra", "annotated" })
public String hello() {
return "Hello, Metrics!";
}
}
Every call to /hello
increases the counter. Watch it grow live inside Hawtio.
Metrics give you the missing link between application code and system behavior. Combined with Jolokia’s deep JVM insights and Hawtio’s friendly interface, you can spot issues earlier and understand your application's true performance.
Why Hawtio and Not Grafana, Loki, or Prometheus?
You might be asking yourself:
"Why use Jolokia and Hawtio when there are serious monitoring tools like Grafana, Loki, and Prometheus?"
The short answer is: different tools, different purposes.
Hawtio is for live inspection and interaction. You are looking at the running JVM internals, exploring MBeans, invoking operations, and checking thread states in real-time. It is hands-on, ideal during development, debugging, or operational troubleshooting.
Grafana and Prometheus are for metrics aggregation and monitoring at scale. They collect data over time, build dashboards, and trigger alerts. Loki handles logs. They are fantastic — but overkill when you just need to peek into one application instance to see what is happening right now.
Think of it like this:
Hawtio is a doctor's stethoscope. You listen directly to the live patient.
Grafana and Prometheus are a hospital’s MRI and monitoring room. You gather detailed diagnostic data over weeks and months.
In practical terms:
During development and testing, Hawtio gives you immediate insights.
In production, Prometheus and Grafana provide system-wide, long-term observability.
They complement each other beautifully.
When you use Hawtio for quick insights and live exploration, it is just as important to manage the risks that come with this kind of powerful internal access, especially once your application leaves your laptop and enters production environments.
Final Touches: Securing Jolokia, Hawtio, and Metrics for Production
By now you have seen how powerful these tools are. But with great power comes great responsibility. Jolokia, Hawtio, and Micrometer expose a lot of internal details. In the wrong hands, this information can be abused to map attacks, exploit vulnerabilities, or disrupt operations.
In short: do not expose these endpoints directly to the internet.
For production environments, consider these best practices:
Disable by Default
The cleanest approach is to enable Jolokia, Hawtio, and Metrics only in non-production profiles.
Example configuration:
%dev.quarkus.jolokia.enabled=true
%prod.quarkus.jolokia.enabled=false
%dev.quarkus.hawtio.authenticationEnabled=false
%prod.quarkus.hawtio.authenticationEnabled=true
%dev.quarkus.smallrye-metrics.enabled=true
%prod.quarkus.smallrye-metrics.enabled=false
In the production profile, the endpoints simply disappear.
Require Authentication and Authorization
If you must run Hawtio or Jolokia in production, enforce authentication:
quarkus.hawtio.authenticationEnabled=true
quarkus.hawtio.realm=hawtio
quarkus.hawtio.role=admin
Configure proper security realms through Quarkus Security extensions like quarkus-elytron-security-properties-file
.
Restrict access at the network level whenever possible.
Expose Metrics Carefully
If metrics scraping is needed for Prometheus, expose only the /q/metrics
endpoint with proper IP filtering, TLS, or authentication.
Only expose what is necessary. Avoid leaking internal data structures, thread states, or exception messages into public metrics.
Conclusion
Jolokia and Hawtio offer a brilliant, lightweight way to understand what your Quarkus application is doing. Combined with Micrometer metrics, you get a complete and extensible observability stack without heavy external agents or vendor lock-in.
Enjoy these tools fully during development and testing. In production, be deliberate. Either lock them down tightly or, even better, disable them entirely unless absolutely necessary.
Happy hacking. And now, you don’t just know how to build great applications with Quarkus — you know how to watch them breathe, think, and evolve in real time.
Further Links
If you want to dive deeper or extend what we covered today, here are some useful resources:
Camel Quarkus Jolokia Extension Documentation
Shows how Jolokia integrates in Camel Quarkus projects and additional configuration options.Hawtio: Running with Quarkus
Official guide for embedding Hawtio directly into your Quarkus applications with examples.Quarkus Micrometer Guide
Offical guide for Micrometer Telemetry in Quarkus
These resources are great next steps if you want to customize your setup further or combine these tools with more complex application stacks.
The latest version of JDK Mission Control and Visual VM both support connecting to jolokia. So you can also take and analyse flight recordings 😄.