OSGi: What are the differences between Apache Felix and Apache Karaf

apache-felixapache-karafosgi

Apache Karaf is a sub project of Apache Felix. It is defined as "a lightweight OSGi container".

I don't understand when should I use the heavyweight and when to use the lightweight. Their site doesn't explain this too much.

Best Answer

The 'lightweight OSGi container' label is contrasting Karaf with more feature rich OSGi containers, not with Felix.

To quote Guillaume Nodet (Karaf's author) from here:

Felix is just the OSGi core runtime. Karaf provides a "distribution" based on Felix by adding other features such as a console, an SSH remoting mechanism, a file deployer and more.

In this diagram of the Karaf architecture, Felix (or other OSGi implementation - currently Equinox is also supported) is the OSGi box, the other boxes are the features added by Karaf:

Karaf Architecture Therefore, unless you have specific needs which are not met by Karaf (requiring access to the underlying implementation) it usually makes sense to use this since it provides more 'out of the box'.

Related Topic