Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
scr-2.1.14
-
None
Description
Problem case: A bundle with two components: Component1 binds Component2 statically, Component2 binds Component1 dynamically. Both components have immediate=true (but changing that also doesn't help).
When starting the bundle, there is (nearly always) a Framework error message from SCR:
ERROR [org.apache.felix.scr] bundle org.apache.felix.scr:2.1.14 (12)Circular reference detected trying to get service [Component1]
stack of references: ServiceReference: [Component1]
ServiceReference: [Component2]
java.lang.Exception: stack trace
at org.apache.felix.scr.impl.ComponentRegistry.enterCreate(ComponentRegistry.java:485)
at org.apache.felix.scr.impl.BundleComponentActivator.enterCreate(BundleComponentActivator.java:735)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:882)
SCR tries it again a few milliseconds later which works.
The real problem here is the error logging indicating that something is not working. This is very disturbing, because the behavior changes from time to time which makes it very hard to see if something is really wrong or if it's just a temporary problem.
In my opinion, SCR should first start Component2 without Component1, then start Component1 and then bind Component1 to Component2.