[ 
https://issues.apache.org/jira/browse/FELIX-6274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17106307#comment-17106307
 ] 

Timothy James Ward commented on FELIX-6274:
-------------------------------------------

I've made a failing test case at [https://github.com/apache/felix-dev/pull/21]

There's definitely a class space issue from using a bundle context with a 
different view - it may actually be that SCR is failing to protect itself from 
the different view of the component bundle.

{{java.lang.ClassCastException: org.apache.felix.log.LogServiceImpl cannot be 
cast to org.osgi.service.log.LogService }}{{at 
org.apache.felix.scr.impl.logger.LogServiceSupport.<init>(LogServiceSupport.java:60)
 }}{{at 
org.apache.felix.scr.impl.logger.LogServiceEnabledLogger$1.addingService(LogServiceEnabledLogger.java:62)
 }}{{at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
 }}{{at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
 }}{{at 
org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) 
}}{{at 
org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) 
}}{{at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) 
}}{{at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) 
}}{{at 
org.apache.felix.scr.impl.logger.LogServiceEnabledLogger.<init>(LogServiceEnabledLogger.java:82)}}{{at
 org.apache.felix.scr.impl.logger.BundleLogger.<init>(BundleLogger.java:34) 
}}{{at 
org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleComponentActivator.java:201)
 }}{{at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:551) 
}}{{at org.apache.felix.scr.impl.Activator.access$200(Activator.java:69) }}{{at 
org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:424) 
}}{{at 
org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196)
 }}{{at 
org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169)
 }}{{at 
org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:49)}}

{{...}}

> Potential Class Space problems with multiple Log Service APIs
> -------------------------------------------------------------
>
>                 Key: FELIX-6274
>                 URL: https://issues.apache.org/jira/browse/FELIX-6274
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-2.1.20
>            Reporter: Timothy James Ward
>            Priority: Major
>             Fix For: scr-2.1.22
>
>
> The Declarative Services specification requires SCR to inject Logger 
> implementations into a DS component (if requested). In order to find a 
> suitable Log Service SCR uses its *own* BundleContext, not the context of the 
> bundle being extended. This means that if the bundle being extended has a 
> different view of the Log Service API then the injection will fail with a 
> ClassCastException.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to