You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2015/08/11 07:09:52 UTC

[jira] [Closed] (FELIX-4792) [SCR] Handle Errors on component initialization

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

Carsten Ziegeler closed FELIX-4792.
-----------------------------------

> [SCR] Handle Errors on component initialization
> -----------------------------------------------
>
>                 Key: FELIX-4792
>                 URL: https://issues.apache.org/jira/browse/FELIX-4792
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.8.2
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: scr-2.0.0
>
>
> During component initialization the component implementation class is loaded. If the class or one of its dependencies cannot be properly loaded a ClassDefNotFound error can be thrown.
> This error bubbles up from BundleComponentActivator.initialEnable to the AbstractExtender.createExtension method, where it is logged. The problem with this is, that the BundleComponentActivator has registered all the components of the bundle with the ComponentRegistry but when the error is thrown, the BundleComponentActivator is not registered in Activator's m_componentBundles map.
> So, when the bundle is stopped, the components registered with the ComponentRegistry stay registered and will never be cleaned away.
> The simple fix is to catch Throwable in the BundleComponentActivator.initialEnable method and log it. The single component failing to load will stay inactive but the rest of the component registration will continue unaffected.
> Background: We have a situation where a bundle is compiled against an API bundle whose exported API is not properly versioned. So the OSGi framework happily wires the bundle to the older API bundle version but one of the components fails to load due to missing API.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)