You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@aries.apache.org by XiLai Dai <xl...@talend.com> on 2013/01/21 09:25:14 UTC

NoSuchComponentException when set update-strategy="reload" on cm:property-placeholder

Hi,

Given a blueprint xml likes this:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
        xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0">

    <cm:property-placeholder persistent-id="abc" update-strategy="reload">
        <cm:default-properties>
            <cm:property name="key1" value="value1" />
            <cm:property name="key2" value="value2" />
        </cm:default-properties>
    </cm:property-placeholder>

    <bean id="myBean" class="org.abc.Abc">
        <property name="mykey1" value="key1"/>
        <property name="mykey1" value="key1"/>
    </bean>

    <service interface="org.abc.interface" ref="myBean"/>

</blueprint>

Which uses cm:property-placeholder to read properties from etc/abc.cfg and expose an osgi service.
The problem here is:  in case there is no abc.cfg existing in the etc/ folder, and set update-strategy="reload" , (be default, update-strategy="none" which works ok but can't auto reload the value of properties ) then, the NoSuchComponentException will be thrown.

Caused by: org.osgi.service.blueprint.container.NoSuchComponentException: No component with id 'myBean' could be found
         at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:55)[9:org.apache.aries.blueprint:0.3.2]
         at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[9:org.apache.aries.blueprint:0.3.2]
         at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[9:org.apache.aries.blueprint:0.3.2]
         at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:198)[9:org.apache.aries.blueprint:0.3.2]
         at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:137)[9:org.apache.aries.blueprint:0.3.2]
         at org.apache.aries.blueprint.container.ServiceRecipe.createRecipe(ServiceRecipe.java:370)[9:org.apache.aries.blueprint:0.3.2]
         at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:278)[9:org.apache.aries.blueprint:0.3.2]
         at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:248)[9:org.apache.aries.blueprint:0.3.2]
         at org.apache.aries.blueprint.container.ServiceRecipe.internalCreate(ServiceRecipe.java:140)[9:org.apache.aries.blueprint:0.3.2]
         at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[9:org.apache.aries.blueprint:0.3.2]
         at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[9:org.apache.aries.blueprint:0.3.2]
         at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:147)[9:org.apache.aries.blueprint:0.3.2]
         at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:631)[9:org.apache.aries.blueprint:0.3.2]
         ... 10 more

(The Aries version is 0.3.2, Karaf verison is 2.2.9)

I've seen maybe a similar bug https://issues.apache.org/jira/browse/ARIES-961 already existing, but still want to get some feed back about my scenario. Thanks!

BR
Xilai