Twitter github

Third Party Bundle Hell?

I recently blogged about how to deal with third party dependencies in an OSGi-based environment and a thought came across my mind about putting ourselves in a crappy situation. What do I mean? Well, let me illustrate with a simple example using the Apache Commons Discovery library. In the Spring Repository we see this:


...
Bundle-SymbolicName: com.springsource.org.apache.commons.discovery
Import-Package: org.apache.commons.logging;version="[1.1.1, 2.0.0)"
...

In the Eclipse Orbit repository:


...
Bundle-SymbolicName: org.apache.commons.discovery
Require-Bundle: org.apache.commons.logging;bundle-version="[1.0.4,2.0.0)", org.junit;bundle-version="[3.8.0,4.0.0)";resolution:=optional
...

I wonder what we’ll see when Apache decides to start offering bundles as a download option… the point here is that we are in a precarious position with third party libraries. Each bundle repository will have its own format when it comes to things… they may conflict or they may not. For example, the current example conflicts because of the choice of using Require-Bundle versus Import-Package as the way to express dependency information. The problem could be fixed if Orbit switched to using Import-Package but this still doesn’t help people who are using Require-Bundle as a client of these libraries.

It seems we may need some set of best practices that bundle repositories follow that ensure bundles from each repository are interoperable. What are people’s thoughts on this topic? Have you been bitten with interoperability issues by using bundles from different repositories? I only see this problem becoming more annoying as more people start adopting OSGi.

  • ekke

    hi chris,
    this is a real problem – I run into the problematic while combining Eclipse RCP, Equinox, Eclipse Riena, EasyBeans, …
    it happens just yesterday again that Riena M4 uses required bundle for a common bundle I’m already using from SpringSource. We had the same problematic before with other bundles from Riena M3 – and the Riena team changed it into import package.

    from my sight I’m using these rules:

    * if using a ‘common’ bundle from ‘foreign’ projects always to use import package
    * using required bundle only if working in the own universe where you have total control over the bundles

    I always try to use import bundle where possible. its some more work, but worth…

    BTW: I’ll publish my experiences with this next week. its not only the required-bundle vs import-package problematic – there’s also the problem using other bundles where you find ‘core’ bundles with 30+ jarfiles inside (Easybeans OSGI)
    logging is another theme….

    I think we need some rules what a good OSGI developer should do and what not

    otherwise its a very hard job to combine different OSGI projects. I also found some problems with PDE where PDE detects cycles in ‘foreign’ bundles – but they are running perfect. but thats another story to blog about

    ekke

  • ekke

    hi chris,this is a real problem – I run into the problematic while combining Eclipse RCP, Equinox, Eclipse Riena, EasyBeans, …it happens just yesterday again that Riena M4 uses required bundle for a common bundle I’m already using from SpringSource. We had the same problematic before with other bundles from Riena M3 – and the Riena team changed it into import package.from my sight I’m using these rules:* if using a ‘common’ bundle from ‘foreign’ projects always to use import package* using required bundle only if working in the own universe where you have total control over the bundlesI always try to use import bundle where possible. its some more work, but worth…BTW: I’ll publish my experiences with this next week. its not only the required-bundle vs import-package problematic – there’s also the problem using other bundles where you find ‘core’ bundles with 30+ jarfiles inside (Easybeans OSGI)logging is another theme….I think we need some rules what a good OSGI developer should do and what nototherwise its a very hard job to combine different OSGI projects. I also found some problems with PDE where PDE detects cycles in ‘foreign’ bundles – but they are running perfect. but thats another story to blog aboutekke

  • Frederic Conrotte

    Hi Chris,

    Indeed I'm also suffering using different repositories using different OSGi packaging. It's a pain in the ass for average developer to identify the problem in such situation.

    I agree on the need of "best practices" between repositories

    >I also found some problems with PDE where PDE detects cycles in 'foreign' bundles – but they are running perfect. but thats another story to blog about

    I ran also thru this "cycle" problem with sl4j bundles. It cames out that one bundle was a fragment hosted by the other one.

  • Frederic Conrotte

    Hi Chris,Indeed I'm also suffering using different repositories using different OSGi packaging. It's a pain in the ass for average developer to identify the problem in such situation.I agree on the need of "best practices" between repositories>I also found some problems with PDE where PDE detects cycles in 'foreign' bundles – but they are running perfect. but thats another story to blog aboutI ran also thru this "cycle" problem with sl4j bundles. It cames out that one bundle was a fragment hosted by the other one.

  • Chris Aniszczyk (zx)

    Ekke, don’t blog about the PDE problem, file a bug so we can keep track of it ๐Ÿ˜‰

  • Chris Aniszczyk (zx)

    Ekke, don’t blog about the PDE problem, file a bug so we can keep track of it ๐Ÿ˜‰

  • ekke

    chris,
    I’ll blog about the solutions – not the problems ๐Ÿ˜‰

    …and report some bugs, but its some work to make it reproducable in a small test-environment and at the moment I have to finish some prototyping-work so my project can go on…

    ekke

  • ekke

    chris,I’ll blog about the solutions – not the problems ;-)…and report some bugs, but its some work to make it reproducable in a small test-environment and at the moment I have to finish some prototyping-work so my project can go on…ekke

  • ekke

    Hi Chris,

    I reported two bugs about my problems with cycles from PDE. (246615, 246617)

    ekke

  • ekke

    Hi Chris,I reported two bugs about my problems with cycles from PDE. (246615, 246617)ekke