For using an agent within an OSGi container, Jolokia comes with an agent packaged as OSGi bundle.
|Jolokia 1.x provided an all-in-one bundle with Felix HTTP Service implementation packaged. This is no longer the case in Jolokia 2.x.
The requirement for target OSGi runtime is to provide an implementation of OSGi CMPN Whiteboard Specification for Jakarta™ Servlet extender. Jolokia 2.0 registers its
org.jolokia.server.core.osgi.OsgiAgentServlet as Whiteboard service, which is then processed by Whiteboard extender.
Because OSGi runtimes are still in the process of moving away from JavaEE towards JakartaEE (with new packages namespace), I tested Jolokia 2 with Karaf 4.5 using dev version of Pax Web 10 (still in development).
Note, that some OSGi containers (like Apache Karaf with Pax Web) come with a so called Web extender which allows for deployment of standard WAR archives. For such container, there is a choice between the OSGi bundle and the WAR agent, where the later is probably easier to deploy.
More details about the OSGi agents can be found in the Jolokia reference manual.