Jolokia: HTTP/JSON bridge for JMX

Jun 9, 2014

Very often there is a need to monitor the Java application server. For example, external monitoring tool, like Nagious/Zenoss/Zabbix needs to get some metrics, like heap memory usage or thread count.

Usual way to get that metrics is to setup access to application server via JMX.

But, sometimes, it is not possible to leave some other port opened for JMX and the only port available is HTTP(80 or 8080) or HTTPS(443 or 8443).

Here the Jolokia comes to rescue!

Jolokia is a HTTP/JSON bridge for JMX server. It can be deployed as web archive (.war) to servlet container and expose MBeans via HTTP.

Also, it is quite lightweight - only 285K for webarchive.


Here is a small instruction how to get an access to JMX beans in Tomcat via Jolokia.

  1. Download jolockia.war and deploy it to servlet container.

  2. Run in command line:

    $ curl localhost:8080/jolokia/read/java.lang:type=Memory/HeapMemoryUsage
    $ curl localhost:8080/jolokia/read/java.lang:type=Memory/HeapMemoryUsage/used
    You may also use your browser to see JSON response. I suggest installing JSON Fromamter for better view.

  3. Now you can configure your monitoring software to ping server periodically and parse “value” attribute from JSON response.

Released version of Jolokia are available in central maven repository:


Also, Jolokia provides OSGi, Mule and JVM agents as well as Webarchive (War) agent.

See Also

Webapp Inter-Communication in Tomcat

Sometimes you need to access services deployed in one web application from another web application within same application server. For Tomcat there is not so many options to do it. In this article we’ll discuss you how to use JMX for communication between web applications.

JSON Validation with JSON Schema

JSON has became a de-facto standard for webservices, replacing XML web services. It has native support in web browser clients.

That makes JSON is the standard of choice for UI-oriented services. It has a good support on mobile devices. Also, it provides smaller data payload size compared to XML and it’s very sufficient for high-load systems as it saves a traffic. But what is for data validation? For XML web services there is a XML Schema. It comes ti mind, that similar standard for JSON should be called “JSON Schema”. And it really exists!

Establishing Customizable Tomcat Configuration

Deploying to Apache Tomcat often requires making changes to default configuration. These changes are often environment specific. Also, when upgrading a Tomcat to new version you need to be sure that all your custom changes have not been lost and were applied to new configuration. To deal with all that stuff Tomcat via separation of the configuration. This post contains step-by-step instruction will help you to establish custom tomcat configuration.

logo   Never miss a story, subscribe to our newsletter