You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Guillaume Nodet <gn...@apache.org> on 2018/02/23 16:59:28 UTC

Re: Blueprint error: "name is already instanciated as null and cannot be removed"

I wonder if this is related to

https://github.com/apache/camel/commit/a4e94f036d02943814c84195d73837cf607c8c20

I suspect the call to camelContext.getComponent(component)  should be
replaced by
 camelContext.getComponent(component, false) in order to avoid the
component to be auto-created.

I'm in vacation tonight, so I won't have time to investigate next week.  If
you have some time, try to build camel-blueprint with the above change
in org.apache.camel.blueprint.handler.CamelNamespaceHandler
line 1056.

Cheers,
Guillaume

2018-02-23 17:27 GMT+01:00 Alex Soto <al...@envieta.com>:

> Hello,
>
> I posted this in the Camel forum, but I have not received any answer, so I
> am trying here as well, since the error is coming from Blueprint.
> I am running Karaf 4.2.5,  in trying to migrate my project to
> Camel 2.20.2 (from 2.17.4)
> I have blueprint configuration:
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:camel="http://camel.apache.org/schema/blueprint"
> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
> xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
> xsi:schemaLocation="
>               http://www.osgi.org/xmlns/blueprint/v1.0.0
>       https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd”>
>
> <cm:property-placeholder persistent-id="audit.log"
> update-strategy="reload”
> placeholder-prefix="#{" placeholder-suffix="}">
> <cm:default-properties>
> <cm:property name="audit-log.reaper.cron" value="0 0/30 * * * ?" />
> <cm:property name="startDelaySeconds" value="600" />
> </cm:default-properties>
> </cm:property-placeholder>
>
> A bean is configured using some properties (in this case for Quartz2, but
> I don’t think this is related to Quartz2):
>
> <bean id="audit-log-reaper-quartz" class="org.apache.
> camel.component.quartz2.QuartzComponent">
> <property name="startDelayedSeconds" value="#{startDelaySeconds}" />
> </bean>
>
> The bean is referenced in a Camel route:
>
> <route id="reaper-scheduler">
>      <from uri="audit-log-reaper-quartz://reaper?cron={{cron}}" />
> ...
>
> When I run this (Karaf 4.2.5) an exception is thrown:
>
> org.osgi.service.blueprint.container.ComponentDefinitionException: Name
> audit-log-reaper-quartz is already instanciated as null and cannot be
> removed.
> at org.apache.aries.blueprint.container.BlueprintRepository.removeRecipe(BlueprintRepository.java:131)
> [38:org.apache.aries.blueprint.core:1.8.3]
> at org.apache.aries.blueprint.container.BlueprintContainerImpl.
> updateUninstantiatedRecipes(BlueprintContainerImpl.java:572)
> [38:org.apache.aries.blueprint.core:1.8.3]
> at org.apache.aries.blueprint.container.BlueprintContainerImpl.
> processProcessors(BlueprintContainerImpl.java:559) [38:org.apache.aries.
> blueprint.core:1.8.3]
> at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(
> BlueprintContainerImpl.java:394) [38:org.apache.aries.
> blueprint.core:1.8.3]
> at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(
> BlueprintContainerImpl.java:275) [38:org.apache.aries.
> blueprint.core:1.8.3]
>
>
>
> Interestingly,  if I remove property place holder:
>
> <bean id="audit-log-reaper-quartz" class="org.apache.
> camel.component.quartz2.QuartzComponent">
> <property name="startDelayedSeconds" value="600" />
> </bean>
>
> Then it works fine, no errors.  So this seems to be related to the
> property placeholders.  Has anybody seen this?
> I appreciate any insight on how to solve this problem.
>
>
> Best regards,
> Alex soto
>
>
>


-- 
------------------------
Guillaume Nodet

Re: Blueprint error: "name is already instanciated as null and cannot be removed"

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
I will take a look on this today or tomorrow.

Regards
JB

On 02/23/2018 05:59 PM, Guillaume Nodet wrote:
> I wonder if this is related to 
>    https://github.com/apache/camel/commit/a4e94f036d02943814c84195d73837cf607c8c20
> 
> I suspect the call to camelContext.getComponent(component)  should be replaced by
>  camelContext.getComponent(component, false) in order to avoid the component to
> be auto-created.
> 
> I'm in vacation tonight, so I won't have time to investigate next week.  If you
> have some time, try to build camel-blueprint with the above change
> in org.apache.camel.blueprint.handler.CamelNamespaceHandler line 1056.
> 
> Cheers,
> Guillaume
> 
> 2018-02-23 17:27 GMT+01:00 Alex Soto <alex.soto@envieta.com
> <ma...@envieta.com>>:
> 
>     Hello, 
> 
>     I posted this in the Camel forum, but I have not received any answer, so I
>     am trying here as well, since the error is coming from Blueprint.
>     I am running Karaf 4.2.5,  in trying to migrate my project to Camel 2.20.2
>     (from 2.17.4) 
>     I have blueprint configuration:
> 
>     <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0
>     <http://www.osgi.org/xmlns/blueprint/v1.0.0>"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
>     <http://www.w3.org/2001/XMLSchema-instance>" 
>     xmlns:camel="http://camel.apache.org/schema/blueprint
>     <http://camel.apache.org/schema/blueprint>"
>     xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
>     <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0>"
>     xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0
>     <http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0>"
>     xsi:schemaLocation="
>                  http://www.osgi.org/xmlns/blueprint/v1.0.0
>     <http://www.osgi.org/xmlns/blueprint/v1.0.0> 
>          https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>     <https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd>”>
> 
>     <cm:property-placeholder persistent-id="audit.log"
>     update-strategy="reload” 
>     placeholder-prefix="#{" placeholder-suffix="}">
>     <cm:default-properties>
>     <cm:property name="audit-log.reaper.cron" value="0 0/30 * * * ?" />
>     <cm:property name="startDelaySeconds"value="600" />
>     </cm:default-properties>
>     </cm:property-placeholder>
> 
>     A bean is configured using some properties (in this case for Quartz2, but I
>     don’t think this is related to Quartz2):
> 
>     <bean id="audit-log-reaper-quartz" class="org.apache.camel.component.quartz2.QuartzComponent">
>     <property name="startDelayedSeconds" value="#{startDelaySeconds}" />
>     </bean>
> 
>     The bean is referenced in a Camel route:
> 
>     <route id="reaper-scheduler">
>         <from uri="audit-log-reaper-quartz://reaper?cron={{cron}}" />
>     ...
> 
>     When I run this (Karaf 4.2.5) an exception is thrown:
> 
>         org.osgi.service.blueprint.container.ComponentDefinitionException: Name
>         audit-log-reaper-quartz is already instanciated as null and cannot be
>         removed.
>         at
>         org.apache.aries.blueprint.container.BlueprintRepository.removeRecipe(BlueprintRepository.java:131)
>         [38:org.apache.aries.blueprint.core:1.8.3]
>         at
>         org.apache.aries.blueprint.container.BlueprintContainerImpl.updateUninstantiatedRecipes(BlueprintContainerImpl.java:572)
>         [38:org.apache.aries.blueprint.core:1.8.3]
>         at
>         org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:559)
>         [38:org.apache.aries.blueprint.core:1.8.3]
>         at
>         org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:394)
>         [38:org.apache.aries.blueprint.core:1.8.3]
>         at
>         org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:275)
>         [38:org.apache.aries.blueprint.core:1.8.3]
> 
> 
> 
>     Interestingly,  if I remove property place holder:
> 
>     <bean id="audit-log-reaper-quartz" class="org.apache.camel.component.quartz2.QuartzComponent">
>     <property name="startDelayedSeconds" value="600" />
>     </bean>
> 
>     Then it works fine, no errors.  So this seems to be related to the property
>     placeholders.  Has anybody seen this? 
>     I appreciate any insight on how to solve this problem.
> 
> 
>     Best regards,
>     Alex soto
> 
> 
> 
> 
> 
> -- 
> ------------------------
> Guillaume Nodet
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Blueprint error: "name is already instanciated as null and cannot be removed"

Posted by Alex Soto <al...@envieta.com>.
You are right, your proposed solution works.  See my reply in the Camel forum.

Best regards,
Alex soto



> On Feb 23, 2018, at 11:59 AM, Guillaume Nodet <gn...@apache.org> wrote:
> 
> I wonder if this is related to 
>    https://github.com/apache/camel/commit/a4e94f036d02943814c84195d73837cf607c8c20 <https://github.com/apache/camel/commit/a4e94f036d02943814c84195d73837cf607c8c20>
> 
> I suspect the call to camelContext.getComponent(component)  should be replaced by
>  camelContext.getComponent(component, false) in order to avoid the component to be auto-created.
> 
> I'm in vacation tonight, so I won't have time to investigate next week.  If you have some time, try to build camel-blueprint with the above change in org.apache.camel.blueprint.handler.CamelNamespaceHandler line 1056.
> 
> Cheers,
> Guillaume
> 
> 2018-02-23 17:27 GMT+01:00 Alex Soto <alex.soto@envieta.com <ma...@envieta.com>>:
> Hello, 
> 
> I posted this in the Camel forum, but I have not received any answer, so I am trying here as well, since the error is coming from Blueprint.
> I am running Karaf 4.2.5,  in trying to migrate my project to Camel 2.20.2 (from 2.17.4) 
> I have blueprint configuration:
> 
> 	<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0 <http://www.osgi.org/xmlns/blueprint/v1.0.0>"
> 		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance <http://www.w3.org/2001/XMLSchema-instance>" 
> 		xmlns:camel="http://camel.apache.org/schema/blueprint <http://camel.apache.org/schema/blueprint>"
> 		xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0>"
> 		xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0 <http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0>"
> 		xsi:schemaLocation="
>              		http://www.osgi.org/xmlns/blueprint/v1.0.0 <http://www.osgi.org/xmlns/blueprint/v1.0.0> 
> 	     		https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd <https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd>”>
> 
> 	<cm:property-placeholder persistent-id="audit.log"
> 		update-strategy="reload” 
> 		placeholder-prefix="#{" placeholder-suffix="}">
> 		<cm:default-properties>
> 			<cm:property name="audit-log.reaper.cron" value="0 0/30 * * * ?" />
> 			<cm:property name="startDelaySeconds"	value="600" />
> 		</cm:default-properties>
> 	</cm:property-placeholder>
> 
> A bean is configured using some properties (in this case for Quartz2, but I don’t think this is related to Quartz2):
> 
> 	<bean id="audit-log-reaper-quartz" class="org.apache.camel.component.quartz2.QuartzComponent">
> 		<property name="startDelayedSeconds" value="#{startDelaySeconds}" />
> 	</bean>
> 
> The bean is referenced in a Camel route:
> 
> 	<route id="reaper-scheduler">
> 	    	<from uri="audit-log-reaper-quartz://reaper?cron={{cron}} <>" />
> 		...
> 
> When I run this (Karaf 4.2.5) an exception is thrown:
> 
> org.osgi.service.blueprint.container.ComponentDefinitionException: Name audit-log-reaper-quartz is already instanciated as null and cannot be removed.
> 	at org.apache.aries.blueprint.container.BlueprintRepository.removeRecipe(BlueprintRepository.java:131) [38:org.apache.aries.blueprint.core:1.8.3]
> 	at org.apache.aries.blueprint.container.BlueprintContainerImpl.updateUninstantiatedRecipes(BlueprintContainerImpl.java:572) [38:org.apache.aries.blueprint.core:1.8.3]
> 	at org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:559) [38:org.apache.aries.blueprint.core:1.8.3]
> 	at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:394) [38:org.apache.aries.blueprint.core:1.8.3]
> 	at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:275) [38:org.apache.aries.blueprint.core:1.8.3]
> 
> 
> Interestingly,  if I remove property place holder:
> 
> 	<bean id="audit-log-reaper-quartz" class="org.apache.camel.component.quartz2.QuartzComponent">
> 		<property name="startDelayedSeconds" value="600" />
> 	</bean>
> 
> Then it works fine, no errors.  So this seems to be related to the property placeholders.  Has anybody seen this? 
> I appreciate any insight on how to solve this problem.
> 
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
> 
> -- 
> ------------------------
> Guillaume Nodet
>