[jira] [Resolved] (SLING-6258) The PackageAdminClassLoader cannot load classes from bundles providing older API versions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (SLING-6258) The PackageAdminClassLoader cannot load classes from bundles providing older API versions

Oliver Lietz (Jira)

     [ https://issues.apache.org/jira/browse/SLING-6258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Radu Cotescu resolved SLING-6258.
---------------------------------
    Resolution: Fixed

Fixed in [r1768759|https://svn.apache.org/r1768759].

> The PackageAdminClassLoader cannot load classes from bundles providing older API versions
> -----------------------------------------------------------------------------------------
>
>                 Key: SLING-6258
>                 URL: https://issues.apache.org/jira/browse/SLING-6258
>             Project: Sling
>          Issue Type: Bug
>          Components: Commons
>    Affects Versions: Commons ClassLoader 1.3.2
>            Reporter: Radu Cotescu
>            Assignee: Radu Cotescu
>             Fix For: Commons ClassLoader 1.3.4
>
>
> The {{org.apache.sling.commons.classloader.impl.PackageAdminClassLoader}} cannot correctly load classes that exist only in bundles providing older API implementations if another bundle providing the same API, but newer version, exists on the instance.
> Assuming bundles A and B both export {{org.example}}, A with version {{1.0.0}} and B with version {{2.0.0}}, when the {{org.apache.sling.commons.classloader.impl.PackageAdminClassLoader}} is queried to resolve a class only available in A, it will try to resolve it from B. This happens because the {{org.apache.sling.commons.classloader.impl.PackageAdminClassLoader}} only checks the bundle that provides the highest API (in terms of version number) of the class' providing package.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Reply | Threaded
Open this post in threaded view
|

Re: [jira] [Resolved] (SLING-6258) The PackageAdminClassLoader cannot load classes from bundles providing older API versions

Felix Meschberger-3
Hi Radu

Not currently able to log into JIRA.

This fix wrong and fails on you.

First the OSGi spec says to resolve to the highest matching version of a package and not just any. So our PackageAdminClassLoader should do the same.

Even ignoring this, you must make sure to always use the same provider for a specific package once you decided for one. Otherwise you get incompatible classes, hard to trace issues, and split package issues.

Regards
Felix

--
Typos caused by my iPhone

> Am 08.11.2016 um 19:35 schrieb Radu Cotescu (JIRA) <[hidden email]>:
>
>
>     [ https://issues.apache.org/jira/browse/SLING-6258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Radu Cotescu resolved SLING-6258.
> ---------------------------------
>    Resolution: Fixed
>
> Fixed in [r1768759|https://svn.apache.org/r1768759].
>
>> The PackageAdminClassLoader cannot load classes from bundles providing older API versions
>> -----------------------------------------------------------------------------------------
>>
>>                Key: SLING-6258
>>                URL: https://issues.apache.org/jira/browse/SLING-6258
>>            Project: Sling
>>         Issue Type: Bug
>>         Components: Commons
>>   Affects Versions: Commons ClassLoader 1.3.2
>>           Reporter: Radu Cotescu
>>           Assignee: Radu Cotescu
>>            Fix For: Commons ClassLoader 1.3.4
>>
>>
>> The {{org.apache.sling.commons.classloader.impl.PackageAdminClassLoader}} cannot correctly load classes that exist only in bundles providing older API implementations if another bundle providing the same API, but newer version, exists on the instance.
>> Assuming bundles A and B both export {{org.example}}, A with version {{1.0.0}} and B with version {{2.0.0}}, when the {{org.apache.sling.commons.classloader.impl.PackageAdminClassLoader}} is queried to resolve a class only available in A, it will try to resolve it from B. This happens because the {{org.apache.sling.commons.classloader.impl.PackageAdminClassLoader}} only checks the bundle that provides the highest API (in terms of version number) of the class' providing package.
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.3.4#6332)