Hi all,

We're trying to migrate our application from Knopflerfish to Felix at the
moment. It's almost working, but we've had a lot of problems with the
following exception:

 INFO ERROR: EventDispatcher: Error during dispatch.
(java.lang.IllegalStateException: Cannot get the Service Registration, owned
by Thread[SCR Component Actor,5,main])
 WARN java.lang.IllegalStateException: Cannot get the Service Registration,
owned by Thread[SCR Component Actor,5,main]
 WARN     at
org.apache.felix.scr.impl.AbstractComponentManager.lockServiceRegistration(AbstractComponentManager.java:782)
 WARN     at
org.apache.felix.scr.impl.AbstractComponentManager.unregisterComponentService(AbstractComponentManager.java:709)
 WARN     at
org.apache.felix.scr.impl.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:549)
 WARN     at
org.apache.felix.scr.impl.AbstractComponentManager.deactivate(AbstractComponentManager.java:238)
 WARN     at
org.apache.felix.scr.impl.AbstractComponentManager.reactivate(AbstractComponentManager.java:171)
 WARN     at
org.apache.felix.scr.impl.DependencyManager.serviceAdded(DependencyManager.java:181)
 WARN     at
org.apache.felix.scr.impl.DependencyManager.serviceChanged(DependencyManager.java:115)
 WARN     at
org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:765)

This seems to have been fixed in FELIX-550. However we're still seeing it,
and it seems to be a problem with static references in factory components
which have a target specified. What seems to happen is when the factory
component is created, the DependencyManager correctly has the m_target field
set. However, when the component is activated, the getProperties() method in
ComponentFactoryImpl doesn't add the properties for the target attributes of
references as ImmediateComponentManager does. Then, when setTargetFilter on
the DependencyManager is called, its target parameter is null (because the
property isn't correctly set) and the SCR interprets this as a change in the
target. Since the reference is static, the component is deactivated and
reactivated incorrectly.

As far as I can tell, the incorrect part is that the reference target
properties are not set for factory components. I can't see anything in 112.6
of the spec which would imply this should not happen. I guess the fix would
be to set those properties in the ComponentFactoryImpl as it's done in the
ImmediateComponentManager?

Cheers,
Colin

Reply via email to