tree: 8fb5c7cb9afe44f426fb8ee5d2570d8e18802839 [path history] [tgz]
  2. karaf-mbean-example-api/
  3. karaf-mbean-example-blueprint/
  4. karaf-mbean-example-features/
  5. karaf-mbean-example-provider/
  6. karaf-mbean-example-scr/
  7. karaf-mbean-example-simple/
  8. pom.xml

Apache Karaf MBean example


This example shows different ways to register a JMX MBean in the Apache Karaf MBeanServer.

It exposes a MBean interacting with a BookingService.


  • karaf-mbean-example-api is a common bundle providing the Booking POJO and a BookingService interface.
  • karaf-mbean-example-provider is a very simple bundle providing a BookingService implementation.
  • karaf-mbean-example-simple is a bundle doing a MBean registration using the Karaf util
  • karaf-mbean-example-blueprint is a bundle doing a MBean registration using blueprint
  • karaf-mbean-example-scr is a bundle doing a MBean registration using SCR


The build uses Apache Maven. Simply use:

mvn clean install

Features and Deployment

On a running Karaf instance, register the features repository:

karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-mbean-example-features/LATEST/xml

Then you can install the service provider feature:

karaf@root()> feature:install karaf-mbean-example-provider

Then you can test the different registration approach:

  • To use the Karaf util registration, you install the karaf-mbean-example-simple feature:
karaf@root()> feature:install karaf-mbean-example-simple
  • To use the blueprint registration, you install the karaf-mbean-example-blueprint feature:
karaf@root()> feature:install karaf-mbean-example-blueprint
  • To use the SCR registration, you install the karaf-mbean-example-scr feature:
karaf@root()> feature:install karaf-mbean-example-scr


Once you have installed a feature registering the MBean, you can see the MBean using any JMX client, like jconsole.