[ https://issues.apache.org/jira/browse/FELIX-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783454#action_12783454 ]
Felix Meschberger commented on FELIX-1903: ------------------------------------------ > So, sorry for having created this issue uselessly. Maybe we stumbled upon missing documentation of the API here ... I created FELIX-1907 for this > SCR sometimes does not activate components when configuration-policy is > required > -------------------------------------------------------------------------------- > > Key: FELIX-1903 > URL: https://issues.apache.org/jira/browse/FELIX-1903 > Project: Felix > Issue Type: Bug > Components: Declarative Services (SCR) > Environment: linux fc10/jdk1.5 > Reporter: Pierre De Rop > Attachments: FELIX-1903.patch, sequence_diagram.pdf > > > This issue is about the following post: > http://www.mail-archive.com/dev@felix.apache.org/msg14019.html > Use case: I have a component which declare configuration-policy="require", > meaning that it must not be activated before the corresponding PID is > available. > But, even if SCR firsts detects that the pid is available, the component is > then not activated, and ends up with the following log: "Missing required > configuration, cannot activate". > Please take a look at the mentioned post, in the DEV mailing list, everything > is explained, with some logs. > I also have attached to this post a sequence diagram which illustrates what > is going on (well, as far as I understand): > 1) In the sequence diagram, you will see that CM first provides the PID to > SCR, by calling the ConfigurationComponentRegistry.configurationEvent() > method. > But in this method, the getComponent(pid) returns null, because the > component's bundle is probably not yet started, at the time we are called by > CM. > 2) Next, the component's bundle is started, and the Component Actor thread > invokes ImmediatComponentManager.activateInternal() method, which invokes > activate() in the Unsatisfied state, > 3) but, then, the hasConfiguration() method is invoked and returns null, and > we then get the log " Missing required configuration, cannot activate". > So, I have tried the attached patch which seems to resolve the issue: I just > have modified the ImmediateComponentManager.hasConfiguration() in order to > check if the PID is available from CM. > (Well, admittedly, the patch is probably dirty and I have added a static > method in the Activator in order to get the bundle context, but it works ...) > please tell me what you think; > /pierre -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.