Using Eclipse databinding with Felix

Using Eclipse databinding with Felix

Update: It turned out that there is already a solution to the problem described here. The bundle org.eclipse.equinox.supplement exports the packages needed by equinox.common. This bundle is available from If you want to run Eclipse databinding, simply inlude this bundle and org.eclipse.equinox.common and you’re set. You can disregard the solution explained below. Thanks Pascal Rapicault for the pointer.

Eclipse databinding is separated into a core and a ui part. The core is designed to be completely independent from the ui, to be usable with any widget toolkit, and it is not even limited to user interfaces. So isn’t it an obvious idea to use it also outside of Eclipse?

We recently tried to do this in a project that runs RAP on Apache Karaf and it turned out that you cannot just throw the core databinding bundles into a Felix OSGi container and hope that they work. In fact, these bundles have a couple of dependencies that cannot be satisfied outside of Eclipse. The same problem exists with JFace.

Here’s the problem: all these bundles use Eclipse core interfaces like IStatus and classes like CoreException. At least IStatus is also exposed by the databinding API (e.g. as return value of a validator), so this cannot be changed. In good Eclipse manner, they don’t simply import the single package that contains all these dependencies (org.eclipse.core.runtime), no they require the bundle that contains it <sigh>. So we have no choice, we have to throw it in. This bundle is called org.eclipse.equinox.common, which is a bit of a misnomer, because it basically exports the core.runtime package. But that’s not the end of the dependency chain, this bundle again needs a couple of packages from the equinox.osgi bundle! Now we don’t want to bring the equinox osgi bundle into the felix osgi container, right? <shiver> That wouldn’t work, and even if it did, we wouldn’t want to do that. Fortunately, it’s not a Require-Bundle this time, just a package import.

This allowed us to create a compatibility bundle which exports those equinox.osgi packages that equinox.common needs to live. And with this bundle in place, equinox.common starts up fine and allows core databinding to run as well. And also JFace and JFace databinding, which have similar dependencies, start and work fine. Here’s an excerpt from the Karaf console:

karaf@root()> bundle:list -s
START LEVEL 80 , List Threshold: 50
   ID   State         Level Symbolic name
[  90] [    Active] [   80] (3.5.300.v20120622-204750)
[  91] [    Active] [   80] org.eclipse.rap.rwt.osgi (
[  92] [    Active] [   80] org.eclipse.core.databinding.observable (1.4.1.v20120521-2329)
[  93] [    Active] [   80] (4.4.2.v20110831)
[  94] [    Active] [   80] org.eclipse.core.databinding (1.4.1.v20120521-2329)
[  95] [    Active] [   80] org.eclipse.core.databinding.beans (1.2.200.v20120523-1955)
[  96] [    Active] [   80] org.eclipse.rap.osgi.compat (
[  97] [    Active] [   80] org.eclipse.core.commands (3.6.1.v20120521-2329)
[  98] [    Active] [   80] org.eclipse.rap.rwt (
[  99] [    Active] [   80] org.eclipse.equinox.common (3.6.100.v20120522-1841)
[ 100] [    Active] [   80] (1.4.100.v20120523-1955)
[ 101] [    Active] [   80] org.eclipse.rap.jface (
[ 102] [    Active] [   80] org.eclipse.rap.jface.databinding (

There’s a whole bunch of Apache bundles in the Eclipse Orbit. Since Juno, at least three Felix bundles are used in Eclipse. On the other hand, Eclipse Jetty is used as servlet container in Apache Karaf. I love to see our communities coming together. But that requires that we make our stuff easier to consume outside Eclipse. As others have quite similar problems, I’m confident that those problems can be resolved one by one.

If you chose Felix as your environment, why shouldn’t you be able to deploy your Eclipse RAP-based admin UI? Since RAP 1.5, you can. If you also want JFace and databinding, get our compatibility bundle from the incubator: source code, ready-made bundle, p2 repository. The bundle is compatible with Eclipse Juno.