tree: 7f03a327c11825d53cde8ec72720600a756ce3e3 [path history] [tgz]
  2. karaf-bundle-example-client/
  3. karaf-bundle-example-common/
  4. karaf-bundle-example-features/
  5. karaf-bundle-example-provider/
  6. pom.xml

Apache Karaf Bundle Example


One of the kind of applications you can deploy in Apache Karaf is obviously OSGi bundle.

The bundle is the core deployment unit when using OSGi. It's basically a regular jar file containing some additional headers in the MANIFEST used by the OSGi framework, and so Karaf.


  • karaf-bundle-example-common provides the BookingService interface and Booking POJO.
  • karaf-bundle-example-provider implements and exposes a BookingService in the OSGi service registry.
  • karaf-bundle-example-client exposes a new ClientService using the BookingService. This service is used to periodically manipulate the BookingService.
  • karaf-bundle-example-features contains a Karaf features repository used for the deployment.

## Build

Simply use:

mvn clean install

## Feature and Deployment

On a running Karaf instance, you register the bundle example features repository with:

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

Then you can install the karaf-bundle-example-provider feature:

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

Now, you can install the karaf-bundle-example-client feature:

karaf@root()> feature:install karaf-bundle-example-client

When you install the client feature, you should see on the console:

karaf@root()> 1794197511025182174 | John Doo | AF3030