views:

3675

answers:

14

For the purposes of building a service framework that works quietly behind the scenes in the JVM, logically separated from whatever the primary application running is, it seems like OSGi really lends itself to this purpose. Some of my challenges are class loader segregation, versioning, "plugability" and.... what's the term?.... updateability.

These are the open source OSGi containers I have been able to find so far:

  1. Apache Felix
  2. Eclipse Equinox
  3. Knoplerfish
  4. Spring Dynamic Modules for OSGi
  5. Concierge
  6. Oscar
  7. Newton

Which one would you recommend ?

If pressed for criteria, I would say:

  • Size/Speed (size is important since we want the OSGi services to be discrete and background)
  • Quality of documentation
  • Learning curve
  • Freshness (keeps on or ahead of emerging specs.)
  • Related support services (like not sure what, but say, for example, a service to support updating remote OSGi containers when a patch/upgrade is available)

Cheers.

+7  A: 

Take a serious look at the SpringSource dm Server. Not only is it an OSGI container but allows you take a staged development approach to OSGI. For example, you can deploy vanilla WAR files to it and then gradually switch over to PAR files and so on.

Being a Spring product the documentation is excellent and extensive:

cletus
Thanks for the reference. I have added Spring OSGi to the list.
Nicholas
SpringSource dm Server actually uses Equinox for its OSGi runtime. Check out http://www.infoq.com/news/2008/10/springsource-dm
laz
+3  A: 
VonC
+2  A: 

Another one I've come across is Concierge - it's incredibly light-weight, and intended to run on a mobile phone or PDA.

I haven't used it yet myself.

http://concierge.sourceforge.net/

Mike Houston
Thanks for the reference. I have added it to the list.
Nicholas
+7  A: 

My experience consists of embedding an OSGi container into an existing Swing-based rich client architecture for signal processing. Initially, I supported both Equniox and Felix, but Equinox proved to be more feature complete (fragments and most of the optional components) in terms of the OSGi spec as well as easier to use. Now I've switched to only using Equinox.

Equinox is under constant development since it is the backbone of Eclipse and associated projects. In general, the only documentation you need is how to startup/bootstap the container. After that, you're in OSGi land and the spec document is one of the best resources. I also feel like Equinox beat Felix in speed, but I have no concrete data to back that up.

basszero
+3  A: 

Take a look at Newton, which is a Jini-enabled OSGI container. It provides advanced facilities for managing your components in a distributed-object capacity and manages dependencies across containers.

Brian Agnew
Thanks for the reference. I have added it to the list.
Nicholas
Do you have experience with it?
Thorbjørn Ravn Andersen
+7  A: 

I've used Felix and Equinox. I felt Felix was easier to use standalone, that is I very quickly got it running and had my app going right away. The console was also more intuitive and had more useful formatting. Equinox's integration with Eclipse, (Eclipse actually runs on it), makes development very easy, but I've found running and testing things solely in an IDE causes problems latter. It took me longer to get it running by itself and was a little more difficult to use, (and I did not end up using it), but the Eclipse team is pretty good so I expect its a solid product still.

Patrick Auld
+1  A: 

We currently use Equinox and have used Felix and Knoplerfish in the past. Equinox seems to be the one that has the most complete OSGi R4 implemention. Concierge is only R3. Additionally, the version of Felix we were using had many issues with Declarative Services, while these worked well with Equinox.

PRO Equinox:

  • Good R4 implementation
  • Actively maintained and massive user-base (due to Eclipse RCP)
  • Highly configurable

CON Equinox:

  • Heavyweight (compared to Felix and Concierge)
  • Certain portion implemented with Eclipse in mind, or tied to Eclipse
  • Not a pure-OSGi implementation, Eclipse have added their own extensions
  • Weak documentation
omerkudat
+3  A: 

Your list is a mixture of OSGi containers and higher-level server products. They are not directly comparable.

For example, Spring dm Server is built upon Equinox and Newton can use Equinox, Felix or Knopflerfish (which are the 3 main OSGi containers).

Oscar looks dead and Concierge only implements version 3 of OSGi (current spec is 4.1) - I assume it's aimed at embedded development.

My main experience is with Equinox and I'd say the Eclipse guys appear to be first when it comes to an up-to-date implementation of the OSGi spec. OSGi 4.2 is due this year with quite a few interesting changes directed at enterprise developers.

I've looked at Newton and Spring dm Server. I didn't like Newton as I felt the SCA stuff on top of OSGi made a steep learing curve. For me Spring dm Server was easier, but version 1.0 is missing some key features (though the first milestone of 2.0 is already available).

You can build your own app server around one of the OSGi containers (using Spring and/or Eclipse for example).

Or maybe you want to embed an OSGi runtime in an existing app server? Equinox can be embedded in a WAR for deployment to any servlet container (I've tested this with Tomcat).

You don't really say what your end-goal is, so it's difficult to give any recommendations.

+1  A: 

Unfortunately there are not feature lists available for all OSGi frameworks. To be a certified OSGi container one has to meet not all of the features described in OSGi core specification (and none of the compendium). Equinox as the reference implementation and with a vibrant community usually fulfills the upcoming spec as the first one. However, others are catching up, while having different goals. Ultimately you have to run tests on your very own requirements to decide wether one implementation is the right fit or not. Sorry, but there is no silver bullet here.

For instance Equinox is great with features but drags quiet some overweight into the system with features you might not want. In the enterprise this is usually no problem when running on a server, but when being on a embedded device, this things might matter.

In terms of tooling support, which is crucial for your development speed, Eclipse offers the best integration yet. It focuses on Equinox though, which for itself makes it appear to be best to be used with Equinox. However, PaxRunner enables you to run any (open source) implementation within Eclipse as well, with the benefit of not emulating the osgi environment with the development switch built into Equinox (, which unfortunately in some rare cases produce a different runtime behavior in the ide compared to stand alone).

Speaking of support, I could recommend the ProSyst mBS, which is the only commercial R4 OSGi implementation I know of. We are using the mBS internally for our products with success and the additional services (like remote management of distributed OSGi instances) and the lean design was the key to choose them over an OpenSource implementation.

Ultimately you exactly have to asses what you need and test for yourself to make the right decision. There is no one rules them all. The key to go for one or another implementation are usually the things NOT defined in the spec in my experience.

Mirko Jahn
+1  A: 

For small devices, limited OSGi runtimes like Concierge might make sense. However, for server deployments, you probably want something with a little more flexibility.

Equinox and Felix are probably the two main contenders (at least, in examples I've seen). The advantage of Felix is that it's not Eclipse; and for good or bad, there are some people who will avoid anything with Eclipse in the name if they're die-hard (NetBeans|IntelliJ) users.

It used to be the case that Felix didn't support fragments (the ability to add code into a running bundle's classpath) but that Eclipse did. I'm not sure if that still holds, but the use of fragments isn't that widespread.

Equinox certainly has had more performance stress testing; if you were looking at really large (hundreds of bundles) systems, then that might be worth swaying the choice.

But in reality, none of the OSGi frameworks will make any difference; the key is how easy it is to design and modularise your applications in an OSGi world; once you've got over that, installing them into the engines is trivial. And I'd also recommend Pax Runner to make it easy to switch in any case.

Note that the above post regarding 'Equinox being non standard' isn't actually correct; Equinox is an OSGi engine. The fact that Eclipse IDE uses extensions (which, incidentally, are themselves OSGi bundles and can be deployed to other OSGi engines) doesn't make it a non-OSGi platform; after all, OSGi platforms are designed to be extended with additional bundles and be build on by modules. And you don't have to use extensions if you don't want to on an Equinox runtime.

AlBlue
+2  A: 

I would recommend Apache Felix because it's easier to bootstrap and it's good enough(spec).

Felix

Let's say you're still in heavy development and want to test things quickly. You can have a main class, add activators to an arraylist without having written manifests and there you go.

Equinox

I usually avoid Equinox because I don't want to write sophisticated launchers(32 bits and 64 bits, and few other things if I recall). With Felix, I don't care much whether I'll be launching on 32 bits or 64 bits. The Eclipse IDE has a great OSGI support in general, the #eclipse IRC channel on Freenode is really active if you need help. Eclipse documentation about OSGI is also good.

Knoplerfish

I really like Knoplerfish GUI bundle manager(still some race conditions in the code) but it's a good effort.

Concierge

I have not used Concierge at all. It looks decent but in early stages of development.

Oscar

Oscar source code if I recall was donated to Apache Felix project, so if you're thinking Oscar, consider Apache Felix first.

Those are not OSGI containers

  • Spring OSGI from my understanding is not an OSGI container itself, it just bootstrap the underlying OSGI container.
  • Newton is an OSGI framework not an OSGI container

Whatever you choose, always test your product in different OSGI containers, just in case. Things might run fine in one and not in the others.

John Doe
A: 

I usually avoid Equinox because I don't want to write sophisticated launchers

I suspect you're confusing the eclipse.exe native launcher(s) with Equinox, which can be bootstrapped from Java using java -jar org.eclipse.osgi_3.3.xxx.jar. No native launchers are needed if you just want to get an OSGi engine up and running.

Note also that OSGi 4.2 provides for a standard way of launching any OSGi framework from a Java process. I wrote up more on OSGi 4.2's new featuers at InfoQ:

http://www.infoq.com/news/2009/07/osgi-next-release

AlBlue
I'm not referring to just launching the OSGI engine, but also auto-installing bundles and starting them in a simple commmand(ie. no reference to native libs and other stuff).
John Doe
That can be done with Equinox as well, using the osgi.bundles property. No native code required ...
AlBlue
A: 

You can try ServiceMix 4, which is based on Felix. I really liked so called features.xml files, where you describe dependencies of you app. Running then in Karaf console is very simple:

features:install your-app

There's also a list of shipped examples, which you run similar way.

You can also check out how to run example web app on embedded jetty here: http://rrusin.blogspot.com/2010/07/jetty-webapp-osgi-way.html

Regards

Rafal Rusin
A: 

I use FUSE ESB. It is based on servicemix 'but tested and supported by the people who wrote the code' (as mentioned on the homepage). It is easy to use with lots of included bundles and useful documentation.

K. Claszen