You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Pierre De Rop (JIRA)" <ji...@apache.org> on 2009/12/06 20:27:18 UTC

[jira] Created: (FELIX-1922) issue with configuration policy=require and with factory components

issue with configuration policy=require and with factory components
-------------------------------------------------------------------

                 Key: FELIX-1922
                 URL: https://issues.apache.org/jira/browse/FELIX-1922
             Project: Felix
          Issue Type: Bug
          Components: Declarative Services (SCR)
    Affects Versions: scr-1.2.0
         Environment: linux fc10, jdk1.5, jdk.1.6
            Reporter: Pierre De Rop
            Priority: Minor


This issue is related to the following dev post: -> http://www.mail-archive.com/dev@felix.apache.org/msg14167.html

There are two components that comes into play: 

1) The first one (EnglishDictionary) has a configuration-policy="require" parameter and a factory="true" parameter:

<?xml version='1.0' encoding='utf-8'?>
<component name='EnglishDictionary' xmlns='http://www.osgi.org/xmlns/scr/v1.1.0' factory='true' configuration-policy='require' modified='updated'>
 <implementation class='com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionary'/>
 <service>
   <provide interface='com.alcatel_lucent.samples.scr.dictionary.DictionaryService'/>
 </service>
</component> 

The EnglishDictionary parameter has actually a CM Configuration which is required before activation: that is why it uses configuration-policy='require'.

2) The second one (EnglishDictionaryFactory) is a factory component that is meant to instantiate the EnglishDictionary component.:

<?xml version='1.0' encoding='utf-8'?>
<component name='EnglishDictionaryFactory'>
 <implementation class='com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionaryFactory'/>
 <reference name='bind' interface='org.osgi.service.component.ComponentFactory' bind='bind' unbind='unbind' target='(component.name=EnglishDictionary)'/>
</component> 


The issue takes place when the EnglishDictionaryFactory component tries to instantiate the EnglishDictionary like this:

class EnglishDictionaryFactory {
  public void bind(ComponentFactory factory) {
    factory.newInstance(new Hashtable());
  } 
}

-> The newInstance raises the following exception:

org.osgi.service.component.ComponentException: Failed activating component
       at org.apache.felix.scr.impl.manager.ComponentFactoryImpl.newInstance(ComponentFactoryImpl.java:118)
       at com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionaryFactory.bind(EnglishDictionaryFactory.java:19)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
       at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38)
       at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:542)
       at org.apache.felix.scr.impl.helper.BaseMethod$NotResolved.invoke(BaseMethod.java:500)
       at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:434)
       at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:997)
       at org.apache.felix.scr.impl.manager.DependencyManager.bind(DependencyManager.java:908)
       at org.apache.felix.scr.impl.manager.DependencyManager.open(DependencyManager.java:832)
       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.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:982)
       at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:297)
       at org.apache.felix.scr.impl.manager.AbstractComponentManager$1.doRun(AbstractComponentManager.java:137)
       at org.apache.felix.scr.impl.ComponentActivatorTask.run(ComponentActivatorTask.java:67)
       at org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:96)
       at java.lang.Thread.run(Thread.java:619)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Work started: (FELIX-1922) issue with configuration policy=require and with factory components

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on FELIX-1922 started by Felix Meschberger.

> issue with configuration policy=require and with factory components
> -------------------------------------------------------------------
>
>                 Key: FELIX-1922
>                 URL: https://issues.apache.org/jira/browse/FELIX-1922
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.2.0
>         Environment: linux fc10, jdk1.5, jdk.1.6
>            Reporter: Pierre De Rop
>            Assignee: Felix Meschberger
>            Priority: Minor
>
> This issue is related to the following dev post: -> http://www.mail-archive.com/dev@felix.apache.org/msg14167.html
> There are two components that comes into play: 
> 1) The first one (EnglishDictionary) has a configuration-policy="require" parameter and a factory="true" parameter:
> <?xml version='1.0' encoding='utf-8'?>
> <component name='EnglishDictionary' xmlns='http://www.osgi.org/xmlns/scr/v1.1.0' factory='true' configuration-policy='require' modified='updated'>
>  <implementation class='com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionary'/>
>  <service>
>    <provide interface='com.alcatel_lucent.samples.scr.dictionary.DictionaryService'/>
>  </service>
> </component> 
> The EnglishDictionary parameter has actually a CM Configuration which is required before activation: that is why it uses configuration-policy='require'.
> 2) The second one (EnglishDictionaryFactory) is a factory component that is meant to instantiate the EnglishDictionary component.:
> <?xml version='1.0' encoding='utf-8'?>
> <component name='EnglishDictionaryFactory'>
>  <implementation class='com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionaryFactory'/>
>  <reference name='bind' interface='org.osgi.service.component.ComponentFactory' bind='bind' unbind='unbind' target='(component.name=EnglishDictionary)'/>
> </component> 
> The issue takes place when the EnglishDictionaryFactory component tries to instantiate the EnglishDictionary like this:
> class EnglishDictionaryFactory {
>   public void bind(ComponentFactory factory) {
>     factory.newInstance(new Hashtable());
>   } 
> }
> -> The newInstance raises the following exception:
> org.osgi.service.component.ComponentException: Failed activating component
>        at org.apache.felix.scr.impl.manager.ComponentFactoryImpl.newInstance(ComponentFactoryImpl.java:118)
>        at com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionaryFactory.bind(EnglishDictionaryFactory.java:19)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
>        at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38)
>        at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:542)
>        at org.apache.felix.scr.impl.helper.BaseMethod$NotResolved.invoke(BaseMethod.java:500)
>        at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:434)
>        at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:997)
>        at org.apache.felix.scr.impl.manager.DependencyManager.bind(DependencyManager.java:908)
>        at org.apache.felix.scr.impl.manager.DependencyManager.open(DependencyManager.java:832)
>        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.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:982)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:297)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager$1.doRun(AbstractComponentManager.java:137)
>        at org.apache.felix.scr.impl.ComponentActivatorTask.run(ComponentActivatorTask.java:67)
>        at org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:96)
>        at java.lang.Thread.run(Thread.java:619)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (FELIX-1922) issue with configuration policy=require and with factory components

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned FELIX-1922:
----------------------------------------

    Assignee: Felix Meschberger

> issue with configuration policy=require and with factory components
> -------------------------------------------------------------------
>
>                 Key: FELIX-1922
>                 URL: https://issues.apache.org/jira/browse/FELIX-1922
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.2.0
>         Environment: linux fc10, jdk1.5, jdk.1.6
>            Reporter: Pierre De Rop
>            Assignee: Felix Meschberger
>            Priority: Minor
>
> This issue is related to the following dev post: -> http://www.mail-archive.com/dev@felix.apache.org/msg14167.html
> There are two components that comes into play: 
> 1) The first one (EnglishDictionary) has a configuration-policy="require" parameter and a factory="true" parameter:
> <?xml version='1.0' encoding='utf-8'?>
> <component name='EnglishDictionary' xmlns='http://www.osgi.org/xmlns/scr/v1.1.0' factory='true' configuration-policy='require' modified='updated'>
>  <implementation class='com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionary'/>
>  <service>
>    <provide interface='com.alcatel_lucent.samples.scr.dictionary.DictionaryService'/>
>  </service>
> </component> 
> The EnglishDictionary parameter has actually a CM Configuration which is required before activation: that is why it uses configuration-policy='require'.
> 2) The second one (EnglishDictionaryFactory) is a factory component that is meant to instantiate the EnglishDictionary component.:
> <?xml version='1.0' encoding='utf-8'?>
> <component name='EnglishDictionaryFactory'>
>  <implementation class='com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionaryFactory'/>
>  <reference name='bind' interface='org.osgi.service.component.ComponentFactory' bind='bind' unbind='unbind' target='(component.name=EnglishDictionary)'/>
> </component> 
> The issue takes place when the EnglishDictionaryFactory component tries to instantiate the EnglishDictionary like this:
> class EnglishDictionaryFactory {
>   public void bind(ComponentFactory factory) {
>     factory.newInstance(new Hashtable());
>   } 
> }
> -> The newInstance raises the following exception:
> org.osgi.service.component.ComponentException: Failed activating component
>        at org.apache.felix.scr.impl.manager.ComponentFactoryImpl.newInstance(ComponentFactoryImpl.java:118)
>        at com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionaryFactory.bind(EnglishDictionaryFactory.java:19)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
>        at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38)
>        at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:542)
>        at org.apache.felix.scr.impl.helper.BaseMethod$NotResolved.invoke(BaseMethod.java:500)
>        at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:434)
>        at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:997)
>        at org.apache.felix.scr.impl.manager.DependencyManager.bind(DependencyManager.java:908)
>        at org.apache.felix.scr.impl.manager.DependencyManager.open(DependencyManager.java:832)
>        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.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:982)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:297)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager$1.doRun(AbstractComponentManager.java:137)
>        at org.apache.felix.scr.impl.ComponentActivatorTask.run(ComponentActivatorTask.java:67)
>        at org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:96)
>        at java.lang.Thread.run(Thread.java:619)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1922) issue with configuration policy=require and with factory components

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790038#action_12790038 ] 

Felix Meschberger commented on FELIX-1922:
------------------------------------------

The problem is actually that Component Factories do not really care about configuration objects: If they are there, they are used as the basis for new components, if they are not existing, it does not matter either.

In addition, according to section 112.5.5, Factory Component, configuration objects are ignored to satisfy component factories (as opposed to other components, which take configurations into account in the case of configuraiton-policy=require).

The fix is to prevent activation failure if no configuration is actually present.

> issue with configuration policy=require and with factory components
> -------------------------------------------------------------------
>
>                 Key: FELIX-1922
>                 URL: https://issues.apache.org/jira/browse/FELIX-1922
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.2.0
>         Environment: linux fc10, jdk1.5, jdk.1.6
>            Reporter: Pierre De Rop
>            Assignee: Felix Meschberger
>            Priority: Minor
>
> This issue is related to the following dev post: -> http://www.mail-archive.com/dev@felix.apache.org/msg14167.html
> There are two components that comes into play: 
> 1) The first one (EnglishDictionary) has a configuration-policy="require" parameter and a factory="true" parameter:
> <?xml version='1.0' encoding='utf-8'?>
> <component name='EnglishDictionary' xmlns='http://www.osgi.org/xmlns/scr/v1.1.0' factory='true' configuration-policy='require' modified='updated'>
>  <implementation class='com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionary'/>
>  <service>
>    <provide interface='com.alcatel_lucent.samples.scr.dictionary.DictionaryService'/>
>  </service>
> </component> 
> The EnglishDictionary parameter has actually a CM Configuration which is required before activation: that is why it uses configuration-policy='require'.
> 2) The second one (EnglishDictionaryFactory) is a factory component that is meant to instantiate the EnglishDictionary component.:
> <?xml version='1.0' encoding='utf-8'?>
> <component name='EnglishDictionaryFactory'>
>  <implementation class='com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionaryFactory'/>
>  <reference name='bind' interface='org.osgi.service.component.ComponentFactory' bind='bind' unbind='unbind' target='(component.name=EnglishDictionary)'/>
> </component> 
> The issue takes place when the EnglishDictionaryFactory component tries to instantiate the EnglishDictionary like this:
> class EnglishDictionaryFactory {
>   public void bind(ComponentFactory factory) {
>     factory.newInstance(new Hashtable());
>   } 
> }
> -> The newInstance raises the following exception:
> org.osgi.service.component.ComponentException: Failed activating component
>        at org.apache.felix.scr.impl.manager.ComponentFactoryImpl.newInstance(ComponentFactoryImpl.java:118)
>        at com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionaryFactory.bind(EnglishDictionaryFactory.java:19)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
>        at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38)
>        at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:542)
>        at org.apache.felix.scr.impl.helper.BaseMethod$NotResolved.invoke(BaseMethod.java:500)
>        at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:434)
>        at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:997)
>        at org.apache.felix.scr.impl.manager.DependencyManager.bind(DependencyManager.java:908)
>        at org.apache.felix.scr.impl.manager.DependencyManager.open(DependencyManager.java:832)
>        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.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:982)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:297)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager$1.doRun(AbstractComponentManager.java:137)
>        at org.apache.felix.scr.impl.ComponentActivatorTask.run(ComponentActivatorTask.java:67)
>        at org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:96)
>        at java.lang.Thread.run(Thread.java:619)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (FELIX-1922) issue with configuration policy=require and with factory components

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger closed FELIX-1922.
------------------------------------


Closing since version is released.

> issue with configuration policy=require and with factory components
> -------------------------------------------------------------------
>
>                 Key: FELIX-1922
>                 URL: https://issues.apache.org/jira/browse/FELIX-1922
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.2.0
>         Environment: linux fc10, jdk1.5, jdk.1.6
>            Reporter: Pierre De Rop
>            Assignee: Felix Meschberger
>            Priority: Minor
>             Fix For:  scr-1.4.0
>
>
> This issue is related to the following dev post: -> http://www.mail-archive.com/dev@felix.apache.org/msg14167.html
> There are two components that comes into play: 
> 1) The first one (EnglishDictionary) has a configuration-policy="require" parameter and a factory="true" parameter:
> <?xml version='1.0' encoding='utf-8'?>
> <component name='EnglishDictionary' xmlns='http://www.osgi.org/xmlns/scr/v1.1.0' factory='true' configuration-policy='require' modified='updated'>
>  <implementation class='com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionary'/>
>  <service>
>    <provide interface='com.alcatel_lucent.samples.scr.dictionary.DictionaryService'/>
>  </service>
> </component> 
> The EnglishDictionary parameter has actually a CM Configuration which is required before activation: that is why it uses configuration-policy='require'.
> 2) The second one (EnglishDictionaryFactory) is a factory component that is meant to instantiate the EnglishDictionary component.:
> <?xml version='1.0' encoding='utf-8'?>
> <component name='EnglishDictionaryFactory'>
>  <implementation class='com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionaryFactory'/>
>  <reference name='bind' interface='org.osgi.service.component.ComponentFactory' bind='bind' unbind='unbind' target='(component.name=EnglishDictionary)'/>
> </component> 
> The issue takes place when the EnglishDictionaryFactory component tries to instantiate the EnglishDictionary like this:
> class EnglishDictionaryFactory {
>   public void bind(ComponentFactory factory) {
>     factory.newInstance(new Hashtable());
>   } 
> }
> -> The newInstance raises the following exception:
> org.osgi.service.component.ComponentException: Failed activating component
>        at org.apache.felix.scr.impl.manager.ComponentFactoryImpl.newInstance(ComponentFactoryImpl.java:118)
>        at com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionaryFactory.bind(EnglishDictionaryFactory.java:19)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
>        at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38)
>        at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:542)
>        at org.apache.felix.scr.impl.helper.BaseMethod$NotResolved.invoke(BaseMethod.java:500)
>        at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:434)
>        at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:997)
>        at org.apache.felix.scr.impl.manager.DependencyManager.bind(DependencyManager.java:908)
>        at org.apache.felix.scr.impl.manager.DependencyManager.open(DependencyManager.java:832)
>        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.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:982)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:297)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager$1.doRun(AbstractComponentManager.java:137)
>        at org.apache.felix.scr.impl.ComponentActivatorTask.run(ComponentActivatorTask.java:67)
>        at org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:96)
>        at java.lang.Thread.run(Thread.java:619)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (FELIX-1922) issue with configuration policy=require and with factory components

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved FELIX-1922.
--------------------------------------

       Resolution: Fixed
    Fix Version/s:  scr-1.2.2

Added testcase ensuring proper operation if configuration is missing in Rev. 890254 (even if configuration-policy=require is set)

In Rev. 890259 always mimick existing configuration to component factory instances. In case of Configuration Admin service not providing configuration, an empty configuration is placed to simulate existence. Reason for this is that component factories do not obey configuration-policy=require for satisfaction setting.

This fixes this issue.

> issue with configuration policy=require and with factory components
> -------------------------------------------------------------------
>
>                 Key: FELIX-1922
>                 URL: https://issues.apache.org/jira/browse/FELIX-1922
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.2.0
>         Environment: linux fc10, jdk1.5, jdk.1.6
>            Reporter: Pierre De Rop
>            Assignee: Felix Meschberger
>            Priority: Minor
>             Fix For:  scr-1.2.2
>
>
> This issue is related to the following dev post: -> http://www.mail-archive.com/dev@felix.apache.org/msg14167.html
> There are two components that comes into play: 
> 1) The first one (EnglishDictionary) has a configuration-policy="require" parameter and a factory="true" parameter:
> <?xml version='1.0' encoding='utf-8'?>
> <component name='EnglishDictionary' xmlns='http://www.osgi.org/xmlns/scr/v1.1.0' factory='true' configuration-policy='require' modified='updated'>
>  <implementation class='com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionary'/>
>  <service>
>    <provide interface='com.alcatel_lucent.samples.scr.dictionary.DictionaryService'/>
>  </service>
> </component> 
> The EnglishDictionary parameter has actually a CM Configuration which is required before activation: that is why it uses configuration-policy='require'.
> 2) The second one (EnglishDictionaryFactory) is a factory component that is meant to instantiate the EnglishDictionary component.:
> <?xml version='1.0' encoding='utf-8'?>
> <component name='EnglishDictionaryFactory'>
>  <implementation class='com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionaryFactory'/>
>  <reference name='bind' interface='org.osgi.service.component.ComponentFactory' bind='bind' unbind='unbind' target='(component.name=EnglishDictionary)'/>
> </component> 
> The issue takes place when the EnglishDictionaryFactory component tries to instantiate the EnglishDictionary like this:
> class EnglishDictionaryFactory {
>   public void bind(ComponentFactory factory) {
>     factory.newInstance(new Hashtable());
>   } 
> }
> -> The newInstance raises the following exception:
> org.osgi.service.component.ComponentException: Failed activating component
>        at org.apache.felix.scr.impl.manager.ComponentFactoryImpl.newInstance(ComponentFactoryImpl.java:118)
>        at com.alcatel_lucent.samples.scr.dictionary.english.EnglishDictionaryFactory.bind(EnglishDictionaryFactory.java:19)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
>        at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38)
>        at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:542)
>        at org.apache.felix.scr.impl.helper.BaseMethod$NotResolved.invoke(BaseMethod.java:500)
>        at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:434)
>        at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:997)
>        at org.apache.felix.scr.impl.manager.DependencyManager.bind(DependencyManager.java:908)
>        at org.apache.felix.scr.impl.manager.DependencyManager.open(DependencyManager.java:832)
>        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.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:982)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:297)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager$1.doRun(AbstractComponentManager.java:137)
>        at org.apache.felix.scr.impl.ComponentActivatorTask.run(ComponentActivatorTask.java:67)
>        at org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:96)
>        at java.lang.Thread.run(Thread.java:619)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.