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

Christoph Läubrich commented on FELIX-4209:
-------------------------------------------

Hi [~djencks] thanks for looking at this. I have checked the spec and if I 
understand right it should be enough to fetch the CA once via scr bundle, and 
then always access configuration with the correct bundle location.
I think the current aproach is also legal BUT then you should at least check 
with ServiceReference#isAssignableTo that it is compatible and emit a waring or 
something instead of failing with exception trace.

[~fmeschbe] I agree that this is a little obsucre scenario but there is afaik 
no restriction to have just one Version of CFG Admin. As mentioned above SCR 
should then not fail with a generic CNF but emit a wqarning and mybe just 
ignore the ConfigAdmin..

I also agree that this is not a common case but still a bug that can be fixed 
relativly easy.
                
> 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