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

David Jencks commented on FELIX-4209:
-------------------------------------

I don't understand what you have in mind.  If SCR doesn't use bundle wiring to 
get the config admin class it would have to access all the methods using 
reflection.  We already use the components bundle to get the CA instance since 
CA is a service factory and we have to use the right CA instance for the bundle 
to get the bundle location set correctly on the configuration.
                
> SCR seems to loads ConfigAdmin class through DS bundle
> ------------------------------------------------------
>
>                 Key: FELIX-4209
>                 URL: https://issues.apache.org/jira/browse/FELIX-4209
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>            Reporter: Christoph Läubrich
>
> I have the following scenario:
> - Equinox Service bundle providing org.osgi.service.cm version="1.3.0"
> - DS Component using  org.osgi.service.cm in version="1.3.0"
> - Felix ConfiguarationAdmin providing version="1.5.0"
> - Felix SCR
> The component fails to initilize because of a ClassCastException that the 
> Apache Felix CM impl can't be cast to org.osgi.service.cm.ConfigurationAdmin
> MESSAGE [-component name-] Cannot register Component
> !STACK 0
> java.lang.ClassCastException: org.apache.felix.cm.impl.ConfigurationAdminImpl 
> cannot be cast to org.osgi.service.cm.ConfigurationAdmin
>       at 
> org.apache.felix.scr.impl.config.ConfigurationComponentRegistry.createComponentHolder(ConfigurationComponentRegistry.java:125)
>       at 
> org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:244)
>       at 
> org.apache.felix.scr.impl.BundleComponentActivator.initialize(BundleComponentActivator.java:147)
>       at 
> org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleComponentActivator.java:111)
>       at 
> org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:285)
>       at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:203)
>       at 
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:847)
>       at 
> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
>       at 
> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
>       at 
> org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1523)
>       at 
> org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1459)
>       at 
> org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1454)
>       at 
> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:391)
>       at 
> org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
>       at 
> org.eclipse.osgi.framework.internal.core.PackageAdminImpl.resumeBundles(PackageAdminImpl.java:313)
>       at 
> org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta(PackageAdminImpl.java:557)
>       at 
> org.eclipse.osgi.framework.internal.core.PackageAdminImpl.doResolveBundles(PackageAdminImpl.java:253)
>       at 
> org.eclipse.osgi.framework.internal.core.PackageAdminImpl$1.run(PackageAdminImpl.java:173)
>       at java.lang.Thread.run(Unknown Source)
> It seems as if the SCR Bundle is fetching either the service or the Class 
> through the DS bundle and thus is getting a wrong reference.
> Changing the DS providing bundle to use cm in version 1.5 fixes the issue, 
> but of course makes it impossible for it to use an older package version.

--
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

Reply via email to