I just created  a ticket for this issue:

https://issues.apache.org/jira/browse/CAMEL-12291 
<https://issues.apache.org/jira/browse/CAMEL-12291>

Feel free to amend if necessary.

Best regards,
Alex soto



> On Feb 23, 2018, at 2:07 PM, Grzegorz Grzybek <gr.grzy...@gmail.com> wrote:
> 
> Hello
> 
> Please check https://issues.apache.org/jira/browse/CAMEL-12251
> There's a problem recently fixed in Camel. CamelNamespaceHandler registers
> two ComponentRegistryProcessors, which (not that correctly) instantiate
> blueprint beans for: components, languages and dataformats. When such
> component bean (e.g., jms for ActiveMQ using ${port} as placeholder) has
> problem (e.g., property not yet available in CM and there's actual
> exception like "can't convert '${port}' to integer"), Camel HIDES THE
> EXCEPTION, or rather prints it at TRACE level.
> 
> So either you use my fix for CAMEL-12251, or you set TRACE level for
> org.apache.camel.blueprint logger.
> 
> regards
> Grzegorz Grzybek
> 
> 2018-02-23 19:49 GMT+01:00 Guillaume Nodet <gno...@apache.org>:
> 
>> Could you please raise a JIRA with the needed information and patch ?
>> 
>> 2018-02-23 19:03 GMT+01:00 Alex Soto <alex.s...@envieta.com>:
>> 
>>> Thank you Guillaume,
>>> 
>>> You are correct,  I tried your suggestion locally and it does work.
>>> I don’t know what are the potential side effects of this change though.
>>> Probably better that somebody more familiar with this code takes a look
>>> and fixes it.
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>>> On Feb 23, 2018, at 12:04 PM, Guillaume Nodet <gno...@apache.org>
>> wrote:
>>>> 
>>>> As I indicated on the Karaf mailing list, I suspect the problem comes
>>> from
>>>> 
>>>> https://github.com/apache/camel/blob/master/components/
>>> camel-blueprint/src/main/java/org/apache/camel/blueprint/
>>> handler/CamelNamespaceHandler.java#L1056
>>>> 
>>>> I think it should call getComponent(component, false) instead to ensure
>>> the
>>>> component is not created eagerly.
>>>> 
>>>> The reason is that the exception is saying that the processor (the
>>> property
>>>> placeholder) can't process the bean because it has been already
>>>> instantiated.  And that call could be the culprit as the OSGi camel
>>> context
>>>> may attempt to create the component.
>>>> 
>>>> That could break the original intent though, in which case, we'd need
>> to
>>> go
>>>> to the blueprint container and check if the component is available
>>> without
>>>> creating it.
>>>> 
>>>> Guillaume
>>>> 
>>>> 
>>>> 2018-02-23 17:55 GMT+01:00 Quinn Stevenson <
>> qu...@pronoia-solutions.com
>>>> :
>>>> 
>>>>> That makes more sense :-)
>>>>> 
>>>>> When I’ve seen this kind of stuff before, it’s usually that the
>>>>> initialization of bean that is a dependency of another bean fails.  I
>>> start
>>>>> at the first exception I see - that usually points me to the right
>>> place.
>>>>> 
>>>>> In this case, it’s acting like it can’t find a setter for the correct
>>> type
>>>>> - maybe that changed across Camel versions?
>>>>> 
>>>>>> On Feb 23, 2018, at 6:49 AM, Alex Soto <alex.s...@envieta.com>
>> wrote:
>>>>>> 
>>>>>> The actual code is well-formed, this was just error formatting the
>> code
>>>>> for the post.  I’ll try again:
>>>>>> 
>>>>>>     <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>
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Feb 22, 2018, at 9:56 PM, Quinn Stevenson <
>>>>> qu...@pronoia-solutions.com> wrote:
>>>>>>> 
>>>>>>> Is that really the XML?  It’s not well formed - you start with a
>>>>> cm:property-placeholder element and end with a cm:default-properties
>>>>> element.
>>>>>>> 
>>>>>>>> On Feb 22, 2018, at 12:48 PM, Alex Soto <alex.s...@envieta.com>
>>> wrote:
>>>>>>>> 
>>>>>>>> Hello,
>>>>>>>> 
>>>>>>>> I am having some problems migrating to Camel 2.20.2 from 2.17.4.  I
>>>>> have blueprint configuration:
>>>>>>>> 
>>>>>>>>           <cm:property-placeholder
>>>>>>>>                           persistent-id=“audit.log”
>>>>>>>>                           update-strategy="reload”
>>>>>>>>                           placeholder-prefix="#{"
>>>>> placeholder-suffix="}”>
>>>>>>>> 
>>>>>>>>                   <cm:property name=“startDelaySeconds"
>> value="600"
>>>>> />
>>>>>>>>                   <cm:property name="cron" value="0 0/30 * * * ?"
>> />
>>>>>>>>           </cm:default-properties>
>>>>>>>> 
>>>>>>>> A component configuration (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>
>>>>>>>> 
>>>>>>>> Then use this in a 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]
>>>>>>>> 
>>>>>>>> 
>>>>>>>> This was working fine in Camel 2.17.4.  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
>>> 
>>> 
>> 
>> 
>> --
>> ------------------------
>> Guillaume Nodet
>> 

Reply via email to