Hi Alain, I note that you don’t include the setter code, nor the activation code, but at a guess in one of these two places you are calling getService on the ComponentServiceObjects. This will in turn cause the ZKRenderer service instance to be created. If this instance also has an injected reference to the current service (i.e. the one you’re asking about in this email) then that’s a cycle. In more complex scenarios there may be other services in between, but fundamentally it’s A -> B -> A. The way around this is to either:
Remove the cycle entirely Make it so that the dependency in one part can be optionally satisfied later Avoid getting an instance from the ComponentServiceObjects until *after* your activate is called. I hope this makes sense, Tim > On 14 Nov 2018, at 13:59, Alain Picard via osgi-dev <osgi-dev@mail.osgi.org> > wrote: > > Facing an issue here. I have a component registering service as such: > @Reference( > cardinality=ReferenceCardinality.MULTIPLE, > policy=ReferencePolicy.DYNAMIC, > scope=PROTOTYPE_REQUIRED, > target=ZKRenderer.CONFIG_TARGET > ) > private void addRenderer(ComponentServiceObjects<ZKRenderer<?>> factory, > Map<String,Object> props) { ...} > > where target is: "(|(iris.zkRenderer.dynamicTester=*) > (iris.zkRenderer.staticTester.element=*))" > to capture only instances that have at least one of those properties. > > I also have other component that defines services under a subinterface of > ZKRenderer, but they don't match the filter. > > But when they get instantiated via componentServiceObject.getService(); it > leads to: > !MESSAGE Circular reference detected trying to get service > {com.castortech.iris.ecp.view.spi.core.zk.ZKRendererFactory}={service.id > <http://service.id/>=502, service.bundleid=418, service.scope=bundle, > component.name > <http://component.name/>=com.castortech.iris.ecp.view.internal.zk.ZKRendererFactoryImpl, > iris.zkRenderer.debug=false, component.id <http://component.id/>=1066} > stack of references: > ServiceReference: (5 or 6 of those) > > debugging I'm finding that it goes through the DependencyManager and seems to > want to register the service against the above service reference. I thought > that it was due to the fact that this was a subinterface and added the > filter, but it doesn't seem to change anything and I'm getting at a lost to > figure this one out. > > Thanks > Alain > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev