title: Dependency chain conflicts for Hibernate and Apache Felix
body: <p>I understand the concept of OSGi complaining about multiple dependency chains - a package is available more than once and when the importing bundle doesn't specify exactly which version it needs, so the OSGi container can run into the trouble of not knowing what to provide.</p>
  
  <p>Unfortunately I ran into such a problem this week, but both involved bundles are third party bundles, so I can't really influence their imports and exports. Here are the two error messages I get:</p>
  
  <pre><code>org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve bundle revision org.hibernate.core [28.0] because it is exposed to package 'javax.xml.stream' from bundle revisions com.springsource.javax.xml.stream [23.0] and org.apache.felix.framework [0] via two dependency chains.
  
  Chain 1:
    org.hibernate.core [28.0]
      import: (osgi.wiring.package=javax.xml.stream)
       |
      export: osgi.wiring.package=javax.xml.stream
    com.springsource.javax.xml.stream [23.0]
  
  Chain 2:
    org.hibernate.core [28.0]
      import: (osgi.wiring.package=javax.xml.transform.stax)
       |
      export: osgi.wiring.package=javax.xml.transform.stax; uses:=javax.xml.stream
      export: osgi.wiring.package=javax.xml.stream
    org.apache.felix.framework [0]
      at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3824) 
      at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
      at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
      at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
      at java.lang.Thread.run(Thread.java:724)
  
  
  
  org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve bundle revision org.hibernate.core [28.0] because it is exposed to package 'javax.xml.stream' from bundle revisions org.apache.felix.framework [0] and com.springsource.javax.xml.stream [23.0] via two dependency chains.
  
  Chain 1:
    org.hibernate.core [28.0]
      import: (osgi.wiring.package=javax.xml.stream)
       |
      export: osgi.wiring.package=javax.xml.stream
    org.apache.felix.framework [0]
  
  Chain 2:
    org.hibernate.core [28.0]
      import: (osgi.wiring.package=org.dom4j.io)
       |
      export: osgi.wiring.package=org.dom4j.io; uses:=javax.xml.stream
    com.springsource.org.dom4j [27.0]
      import: (&amp;(osgi.wiring.package=javax.xml.stream)(version&gt;=1.0.1)(!(version&gt;=2.0.0)))
       |
      export: osgi.wiring.package=javax.xml.stream
    com.springsource.javax.xml.stream [23.0]
      at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3824)
      at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
      at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
      at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
      at java.lang.Thread.run(Thread.java:724)
  </code></pre>
  
  <p>When I try and remove <code>com.springsource.javax.xml.stream</code> from installed bundles, <code>com.springsource.org.dom4j</code> complains about missing package <code>javax.xml.stream</code>.</p>
  
  <p>I checked the <code>MANIFEST.MF</code> file of <code>org.apache.felix.framework</code> because I was really astonished of Felix apparently exporting <code>javax.xml.stream</code>, but it contains no such entry. Also the <code>dom4j</code> bundle does not reexport the streaming package according to it's manifest.</p>
  
  <p>I'd be really grateful for any tips that could get me closer to answer the question where this dependency chain problem comes from. From my point of view I couldn't find a bundle besides <code>com.springsource.javax.xml.stream</code> exporting said package-</p>