Jolokia is a small utility which provides a JSON-based JMX connector over HTTP. WildFly Swarm supports a simple method for adding Jolokia to your application.

Adding Jolokia

To bring Jolokia to your application, you need to add a dependency on the Jolokia fraction:


This is sufficient to bind an unsecured Jolokia to the context root of /jolokia.

If you would like to configure where Jolokia is mounted, you can override the defaults within your main(…​) method:

Swarm swarm = new Swarm();
    new JolokiaFraction("/jmx")

The above would make Jolokia available at the path of /jmx.

Adding the Jolokia fraction to your application will bring in the Undertow fraction implicitly if you have not already included it.


If you need to secure your Jolokia endpoint (which is highly recommended), the JolokiaFraction class supports passing in a pre-existing jolokia-access.xml as a file or URL, or building it programmatically.

  new JolokiaFraction()
    .jolokiaAccess( "/path/to/jolokia-access.xml" )


  new JolokiaFraction()
    .jolokiaAccess( (access)->{ "localhost" );
    } )

Please see the JavaDocs for JolokiaAccess and related classes.