What's new in Karaf 2.2.4 ?

Apache Karaf 2.2.4 has been released this week end.

You can take a look on the release notes.

More than a bug fixes release, this version includes several new features and enhancements.

Command aliases

Previously, the osgi:* commands gathered different kind of usage: osgi:start, osgi:stop, etc are related to bundles, osgi:shutdown is related to container itself, and osgi:ls is OSGi service related.

To be clearer for the users, new aliases have been introduced.

NB: on Karaf trunk (future 3.0.0 release), the commands have been fully renamed (not aliased).


The system:* commands are related to the Karaf container itself:

  •  system:shutdown is equivalent to osgi:shutdown and shutdown the Karaf container
  •  system:start-level is equivalent to osgi:start-level and defines the default start-level to consider bundles as system bundles


The services:* commands are related to OSGi services:

  • services:list is equivalent to ls and lists the OSGi services available


The bundles:* commands are related to OSGi bundles:

  • bundles:list is equivalent to osgi:list and lists the OSGi bundles
  • bundles:install is equivalent to osgi:install and installs OSGi bundles
  • bundles:uninstall is equivalent to osgi:uninstall and uninstalls OSGi bundles
  • bundles:start is equivalent to osgi:start and starts OSGi bundles
  • bundles:stop is equivalent to osgi:stop and stops OSGi bundles
  • bundles:header is equivalent to osgi:headers and displays OSGi bundles headers
  • bundles:info is equivalent to osgi:info and displays bundle.info file
  • bundles:refresh is equivalent to osgi:refresh and refresh OSGi bundles
  • bundles:resolve is equivalent to osgi:resolve and resolves OSGi bundles
  • bundles:restart is equivalent to osgi:restart and restarts OSGi bundles
  • bundles:start-level is equivalent to osgi:start-level and defines the OSGi bundles start level
  • bundles:update is equivalent to osgi:update and updates OSGi bundles

New MBeans

To be able to monitor and administrate with your own tool (Nagios, Apache Kalumet, your own JMX client), Karaf now provides a set of new MBeans.

Bundles MBean

The bundles MBean (org.apache.karaf:type=bundles) allows you to view and change the bundles. As with bundles:* shell commands, you can select bundles using bundle ID (for instance 20), bundle ID range (for instance 21-25 means bundle ID 21, 22, 23, 24, 25), bundle name and version including support of regex (for instance mybunde, mybundle/version, myb*).

  • list() operation gives your a tabular view about all bundles deployed, including the ID, the location, and the current status of the bundle
  • getStartLevel() and setStartLevel() allows you to get/set the start level of bundles
  • refresh() allows to refresh bundles
  • update() allows to update bundles
  • resolve() allows to resolve bundles
  • restart() allows to restart bundles
  • install() installs bundles from an URL. The URL could be a “classic” one (file: or http:), a Maven URL (mvn:), an OBR URL (obr:)
  • start() starts bundles
  • stop() stops bundles
  • uninstall() uninstalls bundles

Config MBean

The config MBean (org.apache.karaf:type=config) allows you to view and change the OSGi configuration (ConfigAdmin layer). As with config:* shell commands, the changes are flushed into the /etc configuration file.

  • list() gives you all configuration PID present in the Karaf container
  • create() creates a new configuration PID
  • delete() deletes a configuration PID
  • proplist() list properties for a given configuration PID
  • propdel() deletes a property from a given configuration PID
  • propappend() appends content to a property in the given configuration PID
  • propset() set/add a property in the given configuration PID

Dev MBean

The dev MBean (org.apache.karaf:type=dev) allows you view the OSGi framework in use and set the framework options:

  • framework() gives the current OSGi framework in use (Felix or Equinox)
  • frameworkOptions() allows you to define OSGi framework options (debug mode, framework to use)
  • restart() allows you to restart the Karaf container

Log MBean

The log MBean (org.apache.karaf:type=log) allows you to view/change the log level currently used (globally or for a given logger):

  • set() sets the log level to use (for the root logger, or for a given logger)
  • get() gives the log level in use (for the root logger, or for a given logger)


The OBR MBean (org.apache.karaf:type=obr) allows you to manipulate the OBR client:

  • listUrls() list the OBR server URL (containing the repository.xml file) register in the Karaf OBR
  • addUrl() adds a new OBR server in the OBR client
  • removeUrl() removes an OBR server from the OBR client
  • refreshUrl() updates the OBR information in the OBR client
  • list() lists the bundles available via the OBR client
  • deploy() deploys a bundle (and its dependency bundles) from the OBR

Packages MBean

The packages MBean (org.apache.karaf:type=packages) allows you to get information about exported and imported packages (and the related bundles):

  • exportedPackages lists the exported package (globally or for a given bundle)
  • importedPackages lists the imported package (globally or for a given bundle)

Services MBean

The services MBean (org.apache.karaf:type=services) allows you to view the OSGi services available:

  • list() lists the OSGi services available (globally, or only one in use, or provided by a given bundle)

System MBean

The system MBean (org.apache.karaf:type=system) allows you to manipulate the Karaf container itself:

  • shutdown() shutdown the Karaf container

Web MBean

The web MBean (org.apache.karaf:type=web) allows you to see the web bundles (web application) available:

  • list() gives you a tabular view of all web application deployed in Karaf (including the bundle and the context path)

Better KAR support

A KAR (Karaf ARchive) artifact is a zip file containing a feature XML descriptor and related bundles jar.

In previous Karaf version, we had issue with the Kar support. In Karaf 2.2.4:

  • the features Maven plugin provides a goal to create a KAR. Simply use a the create-kar goal with a feature.xml and you will have a ready to deploy KAR in the target directory
  • the KAR deployer was not able to correctly uncompress the KAR zip entries, it’s now fixed
  • the KAR deployer now automatically starts all features containing in a KAR file. It means that simply by dropping the KAR file in the deploy folder, Karaf will uncompress the KAR file, correctly creating a Karaf local repository for the KAR, and start all features containing in the KAR shipped feature XML

Spring features

To avoid Spring versions mismatch in others projects (such as Apache Camel, CXF, or ServiceMix), Karaf now provides a large set of Spring features:

  • spring
  • spring-web
  • spring-aspects
  • spring-dm
  • spring-dm-web
  • spring-instrument
  • spring-jdbc
  • spring-jms
  • spring-struts
  • spring-test
  • spring-orm
  • spring-oxm
  • spring-tx
  • spring-web
  • spring-web-portlet

It allows others projects to directly use these features (with a version range), and so, be less coupled to a Spring version.


Some others minors things have been added:

  • the dev:watch command now supports multiple bundle as argument
  • the wrapper service provides a lib for Linux 64 bits platform
  • the J2SE-1.6 and J2SE-1.7 execution environment have been added
  • obr:deploy shell command now supports a -s option to automatically start bundles
  • Karaf JMX service could be configured to use SSL now
  • system:shutdown shell command displays the instance name (for confirmation)


Popular posts from this blog

My first days at Huawei

Apache Karaf and log4j2 appenders

What's new in Apache Karaf 4.2.11 ?