felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lucas Galfaso" <lgalf...@gmail.com>
Subject Re: Interesting observation regarding org.osgi.framework.bootdelegation
Date Fri, 04 Jan 2008 12:07:43 GMT
Hi All,

On Jan 4, 2008 7:19 AM, Felix Meschberger <fmeschbe@gmail.com> wrote:
> Hi all,
> In Apache Sling [1] we had an issue regarding classloading [2], which we
> could solve by using the org.osgi.framework.bootdelegation property and
> sharing a library. Even though the solution with the bootdelegation
> property works, we noticed an interesting situation (see also [3]):
> Consider bundle B1 exporting package P1 and Bundle B2 importing Package
> P1. In addition the bootdelegation property is set to include P1.
> When B2 is resolved (assuming B1 is active), the Felix framework
> correctly resolves the import of P1 to the bundle B1. When a class from
> P1 is accessed (in both B1 and B2), the class is of course loaded
> correctly from the parent class loader as P1 is listed in the
> bootdelegation property.

>From my perspective, I think this is wrong, P1 should not be resolved
to B1 but to the system bundle (unless there is a specific version
constraint.) This is the reason (this is copy&paste from v4.1 of the

The system bundle (bundle ID zero) is used to export non-java.* packages
from the parent class loader. Export definitions from the system bundle are
treated like normal exports, meaning that they can have version numbers,
and are used to resolve import definitions as part of the normal bundle
resolving process. Other bundles may provide alternative implementations
of the same packages.

3.7 Resolving Process
The following list defines the preferences, if multiple choices are possible,
in order of decreasing priority:
- A resolved exporter must be preferred over an unresolved exporter.
- An exporter with a higher version is preferred over an exporter with
a lower version.
- An exporter with a lower bundle ID is preferred over a bundle with a
higher ID.

The system bundle better to be resolved :-p and has id 0, so if there
is no version constraints it should resolve to this bundle.

> The question now is: Is it correct to resolve B2's import of P1 to B1 ?
> Or should imported packages listed in the bootdelegation property not be
> resolved to other bundles ?

They should be resolved, but to the system bundle.


> Regards
> Felix

View raw message