Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343843 - Invalid usage of "Require-Bundle"-attribute prevents bundle from starting
Summary: Invalid usage of "Require-Bundle"-attribute prevents bundle from starting
Status: CLOSED DUPLICATE of bug 329375
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: equinox.framework-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-26 09:40 EDT by Markus Tiede CLA
Modified: 2011-04-26 09:52 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Tiede CLA 2011-04-26 09:40:20 EDT
After switching to the Eclipse Indigo M7 "Version: 3.7.0 Build id: I20110310-1119", an invalid usage of a "Require-Bundle"-attribute prevented one of our bundles from starting: Missing required bundle javax.persistence_[2.0.3,3.0.0).

After migrating from Eclipse 3.6 SR 2 to Eclipse Indigo M7 one of our main bundles "org.eclipse.jubula.client.core" failed during start:

osgi> bundle org.eclipse.jubula.client.core
org.eclipse.jubula.client.core_0.9.0.201104260531 [154]
  Id=154, Status=INSTALLED
  No registered services.
  No services in use.
  No exported packages
  No imported packages
  No fragment bundles
  No named class spaces
  No required bundles

osgi> diag org.eclipse.jubula.client.core
reference:file:plugins/org.eclipse.jubula.client.core_0.9.0.201104260531.jar [154]
  Direct constraints which are unresolved:
    Missing required bundle javax.persistence_[2.0.3,3.0.0).

Although the "javax.persistence"-bundle was available and "ACTIVE":

osgi> bundle javax.persistence
javax.persistence_2.0.3.v201010191057 [11]
  Id=11, Status=ACTIVE
  No registered services.
  No services in use.
  Exported packages
    javax.persistence.spi; version="2.0.3"[exported]
    javax.persistence; version="2.0.3"[exported]
    javax.persistence.criteria; version="2.0.3"[exported]
    javax.persistence.metamodel; version="2.0.3"[exported]
    org.osgi.service.jpa; version="1.0.0"[exported]
  Imported packages
    org.osgi.framework; version="1.6.0"<org.eclipse.osgi_3.7.0.v20110304 [0]>
    javax.sql; version="0.0.0"<org.eclipse.osgi_3.7.0.v20110304 [0]>
  No fragment bundles
  Named class space
    javax.persistence; bundle-version="2.0.3.v201010191057"[provided]
  No required bundles

The same version of our bundle starts in the previous service release (3.6.2) of Eclipse without any problems.

We discovered that we were using an import package attribute jpa="2.0" for the "javax.persistence" bundle dependency which may never have actually had an effect. The line from the "Require-Bundle:" section was as follows:
javax.persistence;bundle-version="[2.0.3,3.0.0)";jpa="2.0";visibility:=reexport

This was changed to:
javax.persistence;bundle-version="[2.0.3,3.0.0)";visibility:=reexport

Removing this attribute resolved the problem for Eclipse Indigo M7. 

The question is now - why did this not lead to an error when working with Eclipse 3.6.2 and why does this problem first occur when trying to start the bundle (instead of e.g. during installation of the feature it belongs to)?
Comment 1 Thomas Watson CLA 2011-04-26 09:50:57 EDT
In OSGi R4.3 arbitrary matching attributes were added to Require-Bundle and Fragment-Host (bug 328508).  Equinox 3.7 implements R4.3 Core Framework specification, this is why you are seeing this issue in 3.7 only.

*** This bug has been marked as a duplicate of bug 329375 ***
Comment 2 Thomas Watson CLA 2011-04-26 09:52:50 EDT
(In reply to comment #0)
> The question is now - why did this not lead to an error when working with
> Eclipse 3.6.2 and why does this problem first occur when trying to start the
> bundle (instead of e.g. during installation of the feature it belongs to)?

This is a question for p2.  You should open a bug against p2.  p2 currently does not pay attention to the arbitrary matching attributes on the Require-Bundle constraints.