felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felix Meschberger (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (FELIX-3723) ClassCastException on ConfigurationAdmin service creating components
Date Thu, 18 Oct 2012 14:52:03 GMT

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

Felix Meschberger reassigned FELIX-3723:
----------------------------------------

    Assignee: Felix Meschberger
    
> ClassCastException on ConfigurationAdmin service creating components 
> ---------------------------------------------------------------------
>
>                 Key: FELIX-3723
>                 URL: https://issues.apache.org/jira/browse/FELIX-3723
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: scr-1.6.2
>
>
> Consider this situation:
>   * Felix SCR 1.6
>         Import-Package: org.osgi.service.cm;version=[1.2,2.0);resolution:=optional
>   * OSGi Enterprise R5 API bundle
>         Export-Package: org.osgi.service.cm;version=1.5
>   * Felix Configuration Admin 1.4.0
>         Export-Package: org.osgi.service.cm;version=1.4
>         Import-Package: org.osgi.service.cm;version=[1.4,1.5)
>   * Component Bundle
>         Import-Package: org.osgi.service.cm;version=[1.4,1.5)
> A component from the "Component Bundle" is registered and SCR happily starts creating
it. SCR uses the Component Bundle's context to get the Configuration Admin serivce. Since
the Component Bundle is wired tothe Felix Configuration Admin bundle it has an appropriate
service implementation and the reference can be returned.
> SCR then uses the Component Bundle's BundleContext to get the service. This succeeds.
> Now SCR tries to cast the service Object to a ConfigurationAdmin object. But since the
SCR bundle itself is wired to another API (the Enterprise one), the ConfugurationAdmin interface
class objects are not the same and the cast fails.
> Consequently, since this is not expected (but should be in this case), component creation
fails.
> The returned service should be checked, whether it can be cast to prevent this kind of
failure.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message