Great resources on solving OSGi “Uses” constraint violations

I recently had the “famous” “uses” constraint violation when building my OSGI application with PDE Build. It was complaining about:

Package uses conflict: Import-Package: javax.mail; version=”1.4.1″

The following resources have helped me locating the root cause and understanding the problem:

http://njbartlett.name/2011/02/09/uses-constraints.html
http://blog.springsource.com/2008/10/20/understanding-the-osgi-uses-directive/
http://blog.springsource.org/2008/11/22/diagnosing-osgi-uses-conflicts/

In my case the culprit was the following effect:

  • one bundle was doing a Require-Bundle: org.eclipse.osgi which is also referred to as the “OSGI system” bundle. According to the first article in Java 6 it automatically exports some core packages of the JDK / JRE into the classpath like javax.activation
  • The problem was that in our OSGI target platform we also had the jar com.springsource.javax.activation-1.1.1.jar which also exports javax.activation
  • The bundle which caused the problem seems to need something from javax.activation (most likely through the import-package of javax.mail and OSGI was not able to resolve this dependency because javax.activation was exported from two sources (JDK because of Require-bundle: org.eclipse.osgi and the jar com.springsource.javax.activation-1.1.1.jar)

Solution:

  • Modify MANIFEST.MF
  • replace Require-Bundle: org.eclipse.osgi with Import-package: org.osgi.framework

After that change the build was successful again.


 

Dieser Beitrag wurde unter Software-Development veröffentlicht. Setze ein Lesezeichen auf den Permalink.

Eine Antwort auf Great resources on solving OSGi “Uses” constraint violations

  1. Découvrez votre destinée avec le Tarot de Marseille qui sert de support de prédiction de ses puissantes arcanes révélatrices.
    Don de voyance extra lucide votre voyant vous propose des tirages de tarot de Marseille en consultations à domicile et en ligne et travaux occultes
    voyant médium consultations et services parapsychologie, bien-être et développement personnel

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

CAPTCHA-Bild

*

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>