9.8 Scoping and Substitutable Exports
Prev | 9. Known Issues | Next

## 9.8 Scoping and Substitutable Exports

The restriction described in Plans and Scoping that no package may be exported by more than one bundle in a given scope can cause problems for bundles with substitutable exports. A substitutable export is a package which is exported and imported by the same bundle. The OSGi framework will discard either the import or the export of the package when the bundle is resolved.

However, if more than one bundle in a scope has a substitutable export of the same package, then Virgo will fail to deploy the scoped application because the above restriction appears to be broken. Virgo could only spot that the restriction was not actually being broken by second guessing the resolution behaviour of the OSGi framework, something that Virgo generally avoids because of the fragility of that approach.

It may be possible to work around this issue by omitting one of the bundles containing the substitutable export from the scoped application.

It may also be possible to work around this issue by moving the bundles containing the substitutable exports outside the scope, although this will not give correct behaviour if the bundles' exported packages need to be available for thread context class loading.

See bug 330643 for an example of this issue.

Prev | Up | Next
9.7 Hibernate Resolution Issue | Home | 9.9 EclipseLink Resolution Issue