Details
Description
I am using 1.4.1.SNAPSHOT-r951313.
Component "Item":
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.osgi.org/xmlns/scr/v1.1.0 http://www.osgi.org/xmlns/scr/v1.1.0">
<implementation class="mycompany.impl.MyItemImpl"/>
<reference interface="mycompany.ItemRegister" bind="setItemRegister" policy="dynamic"/>
<service>
<provide interface="mycompany.Item"/>
</service>
</scr:component>
Component "ItemRegister":
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.osgi.org/xmlns/scr/v1.1.0 http://www.osgi.org/xmlns/scr/v1.1.0">
<implementation class="mycompany.impl.MyItemRegisterImpl"/>
<reference interface="mycompany.Item" bind="addItem" unbind="removeItem" cardinality="0..n" policy="dynamic"/>
<service>
<provide interface="mycompany.ItemRegister"/>
</service>
</scr:component>
Both components reside in the same bundle. On bundle startup I am getting:
java.lang.IllegalStateException: ServiceFactory.getService() resulted in a cycle.
at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:249)
at org.apache.felix.framework.Felix.getService(Felix.java:3022)
at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:329)
at org.apache.felix.scr.impl.manager.DependencyManager.getService(DependencyManager.java:785)
at org.apache.felix.scr.impl.manager.DependencyManager$1.getInstance(DependencyManager.java:1040)
at org.apache.felix.scr.impl.helper.BindMethod.getParameters(BindMethod.java:436)
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:550)
at org.apache.felix.scr.impl.helper.BaseMethod$NotResolved.invoke(BaseMethod.java:508)
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:442)
at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1028)
at org.apache.felix.scr.impl.manager.DependencyManager.bind(DependencyManager.java:944)
at org.apache.felix.scr.impl.manager.DependencyManager.open(DependencyManager.java:868)
at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:200)
at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:118)
at org.apache.felix.scr.impl.manager.DelayedComponentManager.createRealComponent(DelayedComponentManager.java:95)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$Registered.getService(AbstractComponentManager.java:1120)
at org.apache.felix.scr.impl.manager.DelayedComponentManager.getService(DelayedComponentManager.java:88)
at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:307)
at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:221)
at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:295)
at org.apache.felix.framework.Felix.getService(Felix.java:3022)
at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:329)
at org.apache.felix.scr.impl.manager.DependencyManager.getService(DependencyManager.java:785)
at org.apache.felix.scr.impl.manager.DependencyManager$1.getInstance(DependencyManager.java:1040)
at org.apache.felix.scr.impl.helper.BindMethod.getParameters(BindMethod.java:436)
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:550)
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:442)
at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1028)
at org.apache.felix.scr.impl.manager.DependencyManager.bind(DependencyManager.java:932)
at org.apache.felix.scr.impl.manager.DependencyManager.open(DependencyManager.java:868)
at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:200)
at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:118)
at org.apache.felix.scr.impl.manager.DelayedComponentManager.createRealComponent(DelayedComponentManager.java:95)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$Registered.getService(AbstractComponentManager.java:1120)
at org.apache.felix.scr.impl.manager.DelayedComponentManager.getService(DelayedComponentManager.java:88)
at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:307)
at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:221)
at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:295)
at org.apache.felix.framework.Felix.getService(Felix.java:3022)
at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:329)
at org.apache.felix.scr.impl.manager.DependencyManager.getService(DependencyManager.java:785)
at org.apache.felix.scr.impl.manager.DependencyManager$1.getInstance(DependencyManager.java:1040)
at org.apache.felix.scr.impl.helper.BindMethod.getParameters(BindMethod.java:436)
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:550)
at org.apache.felix.scr.impl.helper.BaseMethod$NotResolved.invoke(BaseMethod.java:508)
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:442)
at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1028)
at org.apache.felix.scr.impl.manager.DependencyManager.bind(DependencyManager.java:944)
at org.apache.felix.scr.impl.manager.DependencyManager.open(DependencyManager.java:868)
at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:200)
at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:118)
at org.apache.felix.scr.impl.manager.DelayedComponentManager.createRealComponent(DelayedComponentManager.java:95)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$Registered.getService(AbstractComponentManager.java:1120)
at org.apache.felix.scr.impl.manager.DelayedComponentManager.getService(DelayedComponentManager.java:88)
at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:307)
at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:221)
at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:295)
at org.apache.felix.framework.Felix.getService(Felix.java:3022)
at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:329)
at org.apache.felix.scr.impl.manager.DependencyManager.getService(DependencyManager.java:785)
at org.apache.felix.scr.impl.manager.DependencyManager$1.getInstance(DependencyManager.java:1040)
at org.apache.felix.scr.impl.helper.BindMethod.getParameters(BindMethod.java:436)
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:550)
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:442)
at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1028)
at org.apache.felix.scr.impl.manager.DependencyManager.serviceAdded(DependencyManager.java:308)
at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:170)
at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:864)
at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:732)
at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662)
at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3745)
at org.apache.felix.framework.Felix.access$000(Felix.java:80)
at org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:717)
at org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:107)
at org.apache.felix.framework.Felix.registerService(Felix.java:2862)
at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:251)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:425)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerComponentService(AbstractComponentManager.java:436)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:984)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:309)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:133)
at org.apache.felix.scr.impl.config.ConfiguredComponentHolder.enableComponents(ConfiguredComponentHolder.java:247)
at org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:253)
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:255)
at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:173)
at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:800)
at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:728)
at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3734)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1807)
at org.apache.felix.framework.Felix.updateBundle(Felix.java:2110)
at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:923)
at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:910)
at org.apache.felix.shell.impl.UpdateCommandImpl.execute(UpdateCommandImpl.java:96)
at org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:286)
at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:184)
at java.lang.Thread.run(Thread.java:619)
... other logs ...
2010-06-25 13:58:48,633 ERROR OsgiLogForwarder - gofer-form: FrameworkEvent ERROR
org.apache.felix.log.LogException: org.osgi.framework.ServiceException: Service factory returned null.
at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:340)
at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:221)
at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:295)
at org.apache.felix.framework.Felix.getService(Felix.java:3022)
at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:329)
at org.apache.felix.scr.impl.manager.DependencyManager.getService(DependencyManager.java:785)
at org.apache.felix.scr.impl.manager.DependencyManager$1.getInstance(DependencyManager.java:1040)
at org.apache.felix.scr.impl.helper.BindMethod.getParameters(BindMethod.java:436)
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:550)
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:442)
at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1028)
at org.apache.felix.scr.impl.manager.DependencyManager.bind(DependencyManager.java:932)
at org.apache.felix.scr.impl.manager.DependencyManager.open(DependencyManager.java:868)
at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:200)
at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:118)
at org.apache.felix.scr.impl.manager.DelayedComponentManager.createRealComponent(DelayedComponentManager.java:95)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$Registered.getService(AbstractComponentManager.java:1120)
at org.apache.felix.scr.impl.manager.DelayedComponentManager.getService(DelayedComponentManager.java:88)
at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:307)
at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:221)
at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:295)
at org.apache.felix.framework.Felix.getService(Felix.java:3022)
at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:329)
at org.apache.felix.scr.impl.manager.DependencyManager.getService(DependencyManager.java:785)
at org.apache.felix.scr.impl.manager.DependencyManager$1.getInstance(DependencyManager.java:1040)
at org.apache.felix.scr.impl.helper.BindMethod.getParameters(BindMethod.java:436)
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:550)
at org.apache.felix.scr.impl.helper.BaseMethod$NotResolved.invoke(BaseMethod.java:508)
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:442)
at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1028)
at org.apache.felix.scr.impl.manager.DependencyManager.bind(DependencyManager.java:944)
at org.apache.felix.scr.impl.manager.DependencyManager.open(DependencyManager.java:868)
at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:200)
at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:118)
at org.apache.felix.scr.impl.manager.DelayedComponentManager.createRealComponent(DelayedComponentManager.java:95)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$Registered.getService(AbstractComponentManager.java:1120)
at org.apache.felix.scr.impl.manager.DelayedComponentManager.getService(DelayedComponentManager.java:88)
at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:307)
at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:221)
at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:295)
at org.apache.felix.framework.Felix.getService(Felix.java:3022)
at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:329)
at org.apache.felix.scr.impl.manager.DependencyManager.getService(DependencyManager.java:785)
at org.apache.felix.scr.impl.manager.DependencyManager$1.getInstance(DependencyManager.java:1040)
at org.apache.felix.scr.impl.helper.BindMethod.getParameters(BindMethod.java:436)
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:550)
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:442)
at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1028)
at org.apache.felix.scr.impl.manager.DependencyManager.serviceAdded(DependencyManager.java:308)
at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:170)
at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:864)
at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:732)
at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662)
at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3745)
at org.apache.felix.framework.Felix.access$000(Felix.java:80)
at org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:717)
at org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:107)
at org.apache.felix.framework.Felix.registerService(Felix.java:2862)
at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:251)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:425)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerComponentService(AbstractComponentManager.java:436)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:984)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:309)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:133)
at org.apache.felix.scr.impl.config.ConfiguredComponentHolder.enableComponents(ConfiguredComponentHolder.java:247)
at org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:253)
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:255)
at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:173)
at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:800)
at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:728)
at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3734)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1807)
at org.apache.felix.framework.Felix.updateBundle(Felix.java:2110)
at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:923)
at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:910)
at org.apache.felix.shell.impl.UpdateCommandImpl.execute(UpdateCommandImpl.java:96)
at org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:286)
at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:184)
at java.lang.Thread.run(Thread.java:619)
Sure, there is a cycle but this cycle can be resolved as one of the cardinalities is 0..n. If I manually scr disable the component "Item" and enable it again, then all is OK. Also, if XML definition of the "Item" component is being read later than that of component "ItemRegister", then bundle reloading runs OK. But not on the framework startup.
Attachments
Issue Links
- is related to
-
FELIX-3557 Tests for DS circular dependency behavior
- Closed