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

43,830

Solution 1

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'.

Solution 2

@Marcel Karaf isn't monolithic or huge like a Java EE server. It is a very slim and minimalist implementation. It is a core product without much functionality other than a basic console, file loading so that you can actually read configuration files, etc. The latest zip file of it is 19.1 MB. Yeah. Small. It can easily run on small devices and work in embedded.

What you may be thinking of is something more like ServiceMix which uses Karaf as a core/kernel. But it includes CXF, ActiveMQ, Camel and other libraries in its full configuration. Even then they have minimal, medium and full sizes.

Really, for 99% of the projects out there it wouldn't make sense to start directly with Felix and not use Karaf instead.

Share:
43,830
GabiMe
Author by

GabiMe

Software developer

Updated on July 14, 2022

Comments

  • GabiMe
    GabiMe almost 2 years

    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.

  • Marcel Offermans
    Marcel Offermans almost 10 years
    One nice feature of any OSGi container is that you can select just the bundles you need and deploy them into your container. So my advice would be to first architect your application, and then pick what you need. The advice to "just install the whole platform because it is feature rich" sounds a bit like going back to the huge Java EE application servers. Now I'm not saying that Apache Karaf is anywhere near as big as those, I am just making a point that you can and should just deploy what you actually need.
  • Woodchuck
    Woodchuck about 7 years
    It seems to me this answer is incomplete in that it doesn't mention the use case of embedding Felix in an application (without the need for using a container such as Karaf) - for example to provide plugin capability - which is my interpretation of the following link. Am I wrong? (I'm no expert.) Link: felix.apache.org/documentation/subprojects/…