You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Andrei Petru Mura <ma...@gmail.com> on 2021/09/16 11:57:55 UTC
Using Camel, Blueprint (Aries), OSGI and Spring - Place holder issue
Hi all,
I'm trying to migrate my camel routes from an older karaf using Spring-DM
to a newer one using Blueprint. For this, I intend to import my spring XML
configuration in my blueprint XML file. The camel context is defined in the
blueprint XML file.
Currently I'm stuck with a placeholder issue. I'm trying to import some
configuration properties from OSGI environment which are stored in a few
files under the ${karaf.home}/etc directory.
I tried many ways according to this documentation page (
https://camel.apache.org/components/2.x/properties-component.html), but
still not getting the functionality which I want.
On short, I want to be able to define in my XML files (blueprint, spring)
some default values for some properties, overriding them with the
configurations found in the configuration files from ${karaf.home}/etc/ and
be able to use them in in both blueprint XML and spring XML files.
Preferable by ${variableName}.
Currently, I did this:
Blueprint XML:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bean="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/osgi-compendium
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
">
<cm:property-placeholder id="propertiesBean"
persistent-id="edigrid.persistence,edigrid.server.id
,edigrid.cluster,edigrid.ftpconfig,edigrid.reports">
<cm:default-properties>...</cm:default-properties>
</cm:property-placeholder>
...
<camelContext ...>
<route ...>
... accessing ${configVarHere1}
</route>
</camelContext>
</blueprint>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ctx="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<beans>
<bean id="bridgePropertyPlaceholder"
class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
</bean>
...accessing ${configVarHere2}
</beans>
</beans>
I get this kind of error (because of spring XML):
Failed to convert property value of type 'java.lang.String' to required
type 'int' for property 'configPropName'; nested exception is
java.lang.NumberFormatException: For input string: "${configProprName}"
after I get a few messages like:
The property placeholder processor for ${, } in bundle
bundleName/BundleVersion found an immutable Constructor Argument at
location Bean named beanName->Argument index -1 and value type null->. This
may prevent properties, beans, or other items referenced by this component
from being properly processed.
Any idea how I can solve my issue?
Thanks,
Mura Andrei
Re: Using Camel, Blueprint (Aries), OSGI and Spring - Place holder issue
Posted by Andrei Petru Mura <ma...@gmail.com>.
File.
Thanks,
Andrei
On Fri, Sep 17, 2021 at 9:09 AM JB Onofré <jb...@nanthrax.net> wrote:
> Cm means that it’s backed with ConfigAdmin, so it uses metatype.
> So my question is: what backend do you want : configadmin, file, … ?
>
> Regards
> JB
>
> > Le 17 sept. 2021 à 07:50, Andrei Petru Mura <ma...@gmail.com> a
> écrit :
> >
> > Hi Jean,
> >
> > I think I provided a flat aries blueprint property placeholder backed
> with
> > a file in my initial mail. Maybe I don't understand what a "flat aries
> > blueprint property placeholder" is.
> >
> > Thanks,
> > Andrei
> >> On Thu, Sep 16, 2021 at 5:49 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
> >> wrote:
> >>
> >> You can use a flat aries blueprint property placeholder backed with
> >> ConfigAdmin or a file.
> >>
> >> Is it what you want ?
> >>
> >> Regards
> >> JB
> >>
> >>> On 16/09/2021 15:46, Andrei Petru Mura wrote:
> >>> This definitely isn't a good option as I don't intend to make a
> >> difference
> >>> by the way in which I reference a variable.
> >>> Anyway, property-placeholder doesn't seem to me to be a good option as
> >> some
> >>> of the variables inside my cfg file are seen, some aren't. For example
> I
> >>> get this:
> >>>
> >>> Error creating bean with name 'ftpClientFactory' defined in URL
> >>>
> >>
> [bundle://afa89085-51c4-4cb3-a419-afeccd70a35f_304.0:0/OSGI-INF/blueprint/spring-conf/spring-context.xml]:
> >>> Initialization of bean failed; nested exception is
> >>> org.springframework.beans.TypeMismatchException: Failed to convert
> >> property
> >>> value of type 'java.lang.String' to required type 'int' for property
> >>> 'reconnectRetries'; nested exception is
> java.lang.NumberFormatException:
> >>> For input string: "{{reconnect.retries}}"
> >>>
> >>> In the same spring context, another variable (which is present in the
> >> same
> >>> configuration file) is well referenced.
> >>>
> >>> Thanks,
> >>> Andrei M.
> >>>
> >>>> On Thu, Sep 16, 2021 at 4:12 PM John Taylor <jt...@gmail.com>
> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> A single property-placeholder is only going to allow one backing
> >>>> persistent-id.
> >>>> You can instead create multiple property-placeholders with different
> >> ids,
> >>>> e.g.
> >>>> <cm:property-placeholder id="propertiesBean" persistent-id=">. . .
> >>>> <cm:property-placeholder id="edigrid.cluster" persistent-id=" >. . .
> >>>>
> >>>> see
> >>>>
> >>>>
> >>
> https://stackoverflow.com/questions/50354932/how-to-use-multiple-property-placeholder-in-jboss-fuse-blueprint
> >>>>
> >>>> Hope that helps.
> >>>> -John
> >>>>
> >>>> On Thu, Sep 16, 2021 at 7:58 AM Andrei Petru Mura <
> mapandrei@gmail.com>
> >>>> wrote:
> >>>>
> >>>>> Hi all,
> >>>>>
> >>>>> I'm trying to migrate my camel routes from an older karaf using
> >> Spring-DM
> >>>>> to a newer one using Blueprint. For this, I intend to import my
> spring
> >>>> XML
> >>>>> configuration in my blueprint XML file. The camel context is defined
> in
> >>>> the
> >>>>> blueprint XML file.
> >>>>> Currently I'm stuck with a placeholder issue. I'm trying to import
> some
> >>>>> configuration properties from OSGI environment which are stored in a
> >> few
> >>>>> files under the ${karaf.home}/etc directory.
> >>>>> I tried many ways according to this documentation page (
> >>>>> https://camel.apache.org/components/2.x/properties-component.html),
> >> but
> >>>>> still not getting the functionality which I want.
> >>>>>
> >>>>> On short, I want to be able to define in my XML files (blueprint,
> >> spring)
> >>>>> some default values for some properties, overriding them with the
> >>>>> configurations found in the configuration files from
> ${karaf.home}/etc/
> >>>> and
> >>>>> be able to use them in in both blueprint XML and spring XML files.
> >>>>> Preferable by ${variableName}.
> >>>>>
> >>>>> Currently, I did this:
> >>>>>
> >>>>> Blueprint XML:
> >>>>>
> >>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> >>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>>>> xmlns:bean="http://www.springframework.org/schema/beans"
> >>>>> xmlns:camel="http://camel.apache.org/schema/spring"
> >>>>> xmlns:osgix="
> >> http://www.springframework.org/schema/osgi-compendium"
> >>>>> xmlns:cm="
> >>>> http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
> >>>>> xsi:schemaLocation="
> >>>>> http://www.springframework.org/schema/beans
> >>>>> http://www.springframework.org/schema/beans/spring-beans.xsd
> >>>>> http://camel.apache.org/schema/spring
> >>>>> http://camel.apache.org/schema/spring/camel-spring.xsd
> >>>>> http://www.springframework.org/schema/osgi-compendium
> >>>>>
> >>>>>
> >>>>
> >>
> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
> >>>>> ">
> >>>>>
> >>>>> <cm:property-placeholder id="propertiesBean"
> >>>>> persistent-id="edigrid.persistence,edigrid.server.id
> >>>>> ,edigrid.cluster,edigrid.ftpconfig,edigrid.reports">
> >>>>> <cm:default-properties>...</cm:default-properties>
> >>>>> </cm:property-placeholder>
> >>>>>
> >>>>> ...
> >>>>>
> >>>>> <camelContext ...>
> >>>>> <route ...>
> >>>>> ... accessing ${configVarHere1}
> >>>>> </route>
> >>>>> </camelContext>
> >>>>> </blueprint>
> >>>>>
> >>>>> <beans xmlns="http://www.springframework.org/schema/beans"
> >>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>>>> xmlns:ctx="http://www.springframework.org/schema/context"
> >>>>> xsi:schemaLocation="http://www.springframework.org/schema/beans
> >>>>> http://www.springframework.org/schema/beans/spring-beans.xsd
> >>>>> http://www.springframework.org/schema/context
> >>>>> http://www.springframework.org/schema/context/spring-context.xsd">
> >>>>>
> >>>>> <beans>
> >>>>>
> >>>>> <bean id="bridgePropertyPlaceholder"
> >>>>>
> >> class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
> >>>>> </bean>
> >>>>>
> >>>>> ...accessing ${configVarHere2}
> >>>>> </beans>
> >>>>> </beans>
> >>>>>
> >>>>> I get this kind of error (because of spring XML):
> >>>>> Failed to convert property value of type 'java.lang.String' to
> required
> >>>>> type 'int' for property 'configPropName'; nested exception is
> >>>>> java.lang.NumberFormatException: For input string:
> "${configProprName}"
> >>>>>
> >>>>> after I get a few messages like:
> >>>>> The property placeholder processor for ${, } in bundle
> >>>>> bundleName/BundleVersion found an immutable Constructor Argument at
> >>>>> location Bean named beanName->Argument index -1 and value type
> null->.
> >>>> This
> >>>>> may prevent properties, beans, or other items referenced by this
> >>>> component
> >>>>> from being properly processed.
> >>>>>
> >>>>> Any idea how I can solve my issue?
> >>>>>
> >>>>> Thanks,
> >>>>> Mura Andrei
> >>>>>
> >>>>
> >>>
> >>
>
>
Re: Using Camel, Blueprint (Aries), OSGI and Spring - Place holder issue
Posted by JB Onofré <jb...@nanthrax.net>.
You can use directly camel property placeholder with file in the location.
https://camel.apache.org/manual/latest/using-propertyplaceholder.html
No need to use blueprint property placeholder if you don’t want configadmin backend.
Regards
JB
> Le 17 sept. 2021 à 08:17, Andrei Petru Mura <ma...@gmail.com> a écrit :
>
> By the way,
>
> Is there some documentation on the topic? If not CM, what else should I
> use. I feel a bit dumb because I don't understand the "terminology" :).
>
> Andrei
>
>> On Fri, Sep 17, 2021 at 9:09 AM JB Onofré <jb...@nanthrax.net> wrote:
>>
>> Cm means that it’s backed with ConfigAdmin, so it uses metatype.
>> So my question is: what backend do you want : configadmin, file, … ?
>>
>> Regards
>> JB
>>
>>> Le 17 sept. 2021 à 07:50, Andrei Petru Mura <ma...@gmail.com> a
>> écrit :
>>>
>>> Hi Jean,
>>>
>>> I think I provided a flat aries blueprint property placeholder backed
>> with
>>> a file in my initial mail. Maybe I don't understand what a "flat aries
>>> blueprint property placeholder" is.
>>>
>>> Thanks,
>>> Andrei
>>>> On Thu, Sep 16, 2021 at 5:49 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
>>>> wrote:
>>>>
>>>> You can use a flat aries blueprint property placeholder backed with
>>>> ConfigAdmin or a file.
>>>>
>>>> Is it what you want ?
>>>>
>>>> Regards
>>>> JB
>>>>
>>>>> On 16/09/2021 15:46, Andrei Petru Mura wrote:
>>>>> This definitely isn't a good option as I don't intend to make a
>>>> difference
>>>>> by the way in which I reference a variable.
>>>>> Anyway, property-placeholder doesn't seem to me to be a good option as
>>>> some
>>>>> of the variables inside my cfg file are seen, some aren't. For example
>> I
>>>>> get this:
>>>>>
>>>>> Error creating bean with name 'ftpClientFactory' defined in URL
>>>>>
>>>>
>> [bundle://afa89085-51c4-4cb3-a419-afeccd70a35f_304.0:0/OSGI-INF/blueprint/spring-conf/spring-context.xml]:
>>>>> Initialization of bean failed; nested exception is
>>>>> org.springframework.beans.TypeMismatchException: Failed to convert
>>>> property
>>>>> value of type 'java.lang.String' to required type 'int' for property
>>>>> 'reconnectRetries'; nested exception is
>> java.lang.NumberFormatException:
>>>>> For input string: "{{reconnect.retries}}"
>>>>>
>>>>> In the same spring context, another variable (which is present in the
>>>> same
>>>>> configuration file) is well referenced.
>>>>>
>>>>> Thanks,
>>>>> Andrei M.
>>>>>
>>>>>> On Thu, Sep 16, 2021 at 4:12 PM John Taylor <jt...@gmail.com>
>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> A single property-placeholder is only going to allow one backing
>>>>>> persistent-id.
>>>>>> You can instead create multiple property-placeholders with different
>>>> ids,
>>>>>> e.g.
>>>>>> <cm:property-placeholder id="propertiesBean" persistent-id=">. . .
>>>>>> <cm:property-placeholder id="edigrid.cluster" persistent-id=" >. . .
>>>>>>
>>>>>> see
>>>>>>
>>>>>>
>>>>
>> https://stackoverflow.com/questions/50354932/how-to-use-multiple-property-placeholder-in-jboss-fuse-blueprint
>>>>>>
>>>>>> Hope that helps.
>>>>>> -John
>>>>>>
>>>>>> On Thu, Sep 16, 2021 at 7:58 AM Andrei Petru Mura <
>> mapandrei@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I'm trying to migrate my camel routes from an older karaf using
>>>> Spring-DM
>>>>>>> to a newer one using Blueprint. For this, I intend to import my
>> spring
>>>>>> XML
>>>>>>> configuration in my blueprint XML file. The camel context is defined
>> in
>>>>>> the
>>>>>>> blueprint XML file.
>>>>>>> Currently I'm stuck with a placeholder issue. I'm trying to import
>> some
>>>>>>> configuration properties from OSGI environment which are stored in a
>>>> few
>>>>>>> files under the ${karaf.home}/etc directory.
>>>>>>> I tried many ways according to this documentation page (
>>>>>>> https://camel.apache.org/components/2.x/properties-component.html),
>>>> but
>>>>>>> still not getting the functionality which I want.
>>>>>>>
>>>>>>> On short, I want to be able to define in my XML files (blueprint,
>>>> spring)
>>>>>>> some default values for some properties, overriding them with the
>>>>>>> configurations found in the configuration files from
>> ${karaf.home}/etc/
>>>>>> and
>>>>>>> be able to use them in in both blueprint XML and spring XML files.
>>>>>>> Preferable by ${variableName}.
>>>>>>>
>>>>>>> Currently, I did this:
>>>>>>>
>>>>>>> Blueprint XML:
>>>>>>>
>>>>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>> xmlns:bean="http://www.springframework.org/schema/beans"
>>>>>>> xmlns:camel="http://camel.apache.org/schema/spring"
>>>>>>> xmlns:osgix="
>>>> http://www.springframework.org/schema/osgi-compendium"
>>>>>>> xmlns:cm="
>>>>>> http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
>>>>>>> xsi:schemaLocation="
>>>>>>> http://www.springframework.org/schema/beans
>>>>>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>>>>>> http://camel.apache.org/schema/spring
>>>>>>> http://camel.apache.org/schema/spring/camel-spring.xsd
>>>>>>> http://www.springframework.org/schema/osgi-compendium
>>>>>>>
>>>>>>>
>>>>>>
>>>>
>> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
>>>>>>> ">
>>>>>>>
>>>>>>> <cm:property-placeholder id="propertiesBean"
>>>>>>> persistent-id="edigrid.persistence,edigrid.server.id
>>>>>>> ,edigrid.cluster,edigrid.ftpconfig,edigrid.reports">
>>>>>>> <cm:default-properties>...</cm:default-properties>
>>>>>>> </cm:property-placeholder>
>>>>>>>
>>>>>>> ...
>>>>>>>
>>>>>>> <camelContext ...>
>>>>>>> <route ...>
>>>>>>> ... accessing ${configVarHere1}
>>>>>>> </route>
>>>>>>> </camelContext>
>>>>>>> </blueprint>
>>>>>>>
>>>>>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>> xmlns:ctx="http://www.springframework.org/schema/context"
>>>>>>> xsi:schemaLocation="http://www.springframework.org/schema/beans
>>>>>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>>>>>> http://www.springframework.org/schema/context
>>>>>>> http://www.springframework.org/schema/context/spring-context.xsd">
>>>>>>>
>>>>>>> <beans>
>>>>>>>
>>>>>>> <bean id="bridgePropertyPlaceholder"
>>>>>>>
>>>> class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
>>>>>>> </bean>
>>>>>>>
>>>>>>> ...accessing ${configVarHere2}
>>>>>>> </beans>
>>>>>>> </beans>
>>>>>>>
>>>>>>> I get this kind of error (because of spring XML):
>>>>>>> Failed to convert property value of type 'java.lang.String' to
>> required
>>>>>>> type 'int' for property 'configPropName'; nested exception is
>>>>>>> java.lang.NumberFormatException: For input string:
>> "${configProprName}"
>>>>>>>
>>>>>>> after I get a few messages like:
>>>>>>> The property placeholder processor for ${, } in bundle
>>>>>>> bundleName/BundleVersion found an immutable Constructor Argument at
>>>>>>> location Bean named beanName->Argument index -1 and value type
>> null->.
>>>>>> This
>>>>>>> may prevent properties, beans, or other items referenced by this
>>>>>> component
>>>>>>> from being properly processed.
>>>>>>>
>>>>>>> Any idea how I can solve my issue?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Mura Andrei
>>>>>>>
>>>>>>
>>>>>
>>>>
>>
>>
Re: Using Camel, Blueprint (Aries), OSGI and Spring - Place holder issue
Posted by JB Onofré <jb...@nanthrax.net>.
By the way you can find some details about ConfigAdmin on the Karaf documentation.
> Le 17 sept. 2021 à 08:17, Andrei Petru Mura <ma...@gmail.com> a écrit :
>
> By the way,
>
> Is there some documentation on the topic? If not CM, what else should I
> use. I feel a bit dumb because I don't understand the "terminology" :).
>
> Andrei
>
>> On Fri, Sep 17, 2021 at 9:09 AM JB Onofré <jb...@nanthrax.net> wrote:
>>
>> Cm means that it’s backed with ConfigAdmin, so it uses metatype.
>> So my question is: what backend do you want : configadmin, file, … ?
>>
>> Regards
>> JB
>>
>>> Le 17 sept. 2021 à 07:50, Andrei Petru Mura <ma...@gmail.com> a
>> écrit :
>>>
>>> Hi Jean,
>>>
>>> I think I provided a flat aries blueprint property placeholder backed
>> with
>>> a file in my initial mail. Maybe I don't understand what a "flat aries
>>> blueprint property placeholder" is.
>>>
>>> Thanks,
>>> Andrei
>>>> On Thu, Sep 16, 2021 at 5:49 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
>>>> wrote:
>>>>
>>>> You can use a flat aries blueprint property placeholder backed with
>>>> ConfigAdmin or a file.
>>>>
>>>> Is it what you want ?
>>>>
>>>> Regards
>>>> JB
>>>>
>>>>> On 16/09/2021 15:46, Andrei Petru Mura wrote:
>>>>> This definitely isn't a good option as I don't intend to make a
>>>> difference
>>>>> by the way in which I reference a variable.
>>>>> Anyway, property-placeholder doesn't seem to me to be a good option as
>>>> some
>>>>> of the variables inside my cfg file are seen, some aren't. For example
>> I
>>>>> get this:
>>>>>
>>>>> Error creating bean with name 'ftpClientFactory' defined in URL
>>>>>
>>>>
>> [bundle://afa89085-51c4-4cb3-a419-afeccd70a35f_304.0:0/OSGI-INF/blueprint/spring-conf/spring-context.xml]:
>>>>> Initialization of bean failed; nested exception is
>>>>> org.springframework.beans.TypeMismatchException: Failed to convert
>>>> property
>>>>> value of type 'java.lang.String' to required type 'int' for property
>>>>> 'reconnectRetries'; nested exception is
>> java.lang.NumberFormatException:
>>>>> For input string: "{{reconnect.retries}}"
>>>>>
>>>>> In the same spring context, another variable (which is present in the
>>>> same
>>>>> configuration file) is well referenced.
>>>>>
>>>>> Thanks,
>>>>> Andrei M.
>>>>>
>>>>>> On Thu, Sep 16, 2021 at 4:12 PM John Taylor <jt...@gmail.com>
>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> A single property-placeholder is only going to allow one backing
>>>>>> persistent-id.
>>>>>> You can instead create multiple property-placeholders with different
>>>> ids,
>>>>>> e.g.
>>>>>> <cm:property-placeholder id="propertiesBean" persistent-id=">. . .
>>>>>> <cm:property-placeholder id="edigrid.cluster" persistent-id=" >. . .
>>>>>>
>>>>>> see
>>>>>>
>>>>>>
>>>>
>> https://stackoverflow.com/questions/50354932/how-to-use-multiple-property-placeholder-in-jboss-fuse-blueprint
>>>>>>
>>>>>> Hope that helps.
>>>>>> -John
>>>>>>
>>>>>> On Thu, Sep 16, 2021 at 7:58 AM Andrei Petru Mura <
>> mapandrei@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I'm trying to migrate my camel routes from an older karaf using
>>>> Spring-DM
>>>>>>> to a newer one using Blueprint. For this, I intend to import my
>> spring
>>>>>> XML
>>>>>>> configuration in my blueprint XML file. The camel context is defined
>> in
>>>>>> the
>>>>>>> blueprint XML file.
>>>>>>> Currently I'm stuck with a placeholder issue. I'm trying to import
>> some
>>>>>>> configuration properties from OSGI environment which are stored in a
>>>> few
>>>>>>> files under the ${karaf.home}/etc directory.
>>>>>>> I tried many ways according to this documentation page (
>>>>>>> https://camel.apache.org/components/2.x/properties-component.html),
>>>> but
>>>>>>> still not getting the functionality which I want.
>>>>>>>
>>>>>>> On short, I want to be able to define in my XML files (blueprint,
>>>> spring)
>>>>>>> some default values for some properties, overriding them with the
>>>>>>> configurations found in the configuration files from
>> ${karaf.home}/etc/
>>>>>> and
>>>>>>> be able to use them in in both blueprint XML and spring XML files.
>>>>>>> Preferable by ${variableName}.
>>>>>>>
>>>>>>> Currently, I did this:
>>>>>>>
>>>>>>> Blueprint XML:
>>>>>>>
>>>>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>> xmlns:bean="http://www.springframework.org/schema/beans"
>>>>>>> xmlns:camel="http://camel.apache.org/schema/spring"
>>>>>>> xmlns:osgix="
>>>> http://www.springframework.org/schema/osgi-compendium"
>>>>>>> xmlns:cm="
>>>>>> http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
>>>>>>> xsi:schemaLocation="
>>>>>>> http://www.springframework.org/schema/beans
>>>>>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>>>>>> http://camel.apache.org/schema/spring
>>>>>>> http://camel.apache.org/schema/spring/camel-spring.xsd
>>>>>>> http://www.springframework.org/schema/osgi-compendium
>>>>>>>
>>>>>>>
>>>>>>
>>>>
>> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
>>>>>>> ">
>>>>>>>
>>>>>>> <cm:property-placeholder id="propertiesBean"
>>>>>>> persistent-id="edigrid.persistence,edigrid.server.id
>>>>>>> ,edigrid.cluster,edigrid.ftpconfig,edigrid.reports">
>>>>>>> <cm:default-properties>...</cm:default-properties>
>>>>>>> </cm:property-placeholder>
>>>>>>>
>>>>>>> ...
>>>>>>>
>>>>>>> <camelContext ...>
>>>>>>> <route ...>
>>>>>>> ... accessing ${configVarHere1}
>>>>>>> </route>
>>>>>>> </camelContext>
>>>>>>> </blueprint>
>>>>>>>
>>>>>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>> xmlns:ctx="http://www.springframework.org/schema/context"
>>>>>>> xsi:schemaLocation="http://www.springframework.org/schema/beans
>>>>>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>>>>>> http://www.springframework.org/schema/context
>>>>>>> http://www.springframework.org/schema/context/spring-context.xsd">
>>>>>>>
>>>>>>> <beans>
>>>>>>>
>>>>>>> <bean id="bridgePropertyPlaceholder"
>>>>>>>
>>>> class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
>>>>>>> </bean>
>>>>>>>
>>>>>>> ...accessing ${configVarHere2}
>>>>>>> </beans>
>>>>>>> </beans>
>>>>>>>
>>>>>>> I get this kind of error (because of spring XML):
>>>>>>> Failed to convert property value of type 'java.lang.String' to
>> required
>>>>>>> type 'int' for property 'configPropName'; nested exception is
>>>>>>> java.lang.NumberFormatException: For input string:
>> "${configProprName}"
>>>>>>>
>>>>>>> after I get a few messages like:
>>>>>>> The property placeholder processor for ${, } in bundle
>>>>>>> bundleName/BundleVersion found an immutable Constructor Argument at
>>>>>>> location Bean named beanName->Argument index -1 and value type
>> null->.
>>>>>> This
>>>>>>> may prevent properties, beans, or other items referenced by this
>>>>>> component
>>>>>>> from being properly processed.
>>>>>>>
>>>>>>> Any idea how I can solve my issue?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Mura Andrei
>>>>>>>
>>>>>>
>>>>>
>>>>
>>
>>
Re: Using Camel, Blueprint (Aries), OSGI and Spring - Place holder issue
Posted by Andrei Petru Mura <ma...@gmail.com>.
By the way,
Is there some documentation on the topic? If not CM, what else should I
use. I feel a bit dumb because I don't understand the "terminology" :).
Andrei
On Fri, Sep 17, 2021 at 9:09 AM JB Onofré <jb...@nanthrax.net> wrote:
> Cm means that it’s backed with ConfigAdmin, so it uses metatype.
> So my question is: what backend do you want : configadmin, file, … ?
>
> Regards
> JB
>
> > Le 17 sept. 2021 à 07:50, Andrei Petru Mura <ma...@gmail.com> a
> écrit :
> >
> > Hi Jean,
> >
> > I think I provided a flat aries blueprint property placeholder backed
> with
> > a file in my initial mail. Maybe I don't understand what a "flat aries
> > blueprint property placeholder" is.
> >
> > Thanks,
> > Andrei
> >> On Thu, Sep 16, 2021 at 5:49 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
> >> wrote:
> >>
> >> You can use a flat aries blueprint property placeholder backed with
> >> ConfigAdmin or a file.
> >>
> >> Is it what you want ?
> >>
> >> Regards
> >> JB
> >>
> >>> On 16/09/2021 15:46, Andrei Petru Mura wrote:
> >>> This definitely isn't a good option as I don't intend to make a
> >> difference
> >>> by the way in which I reference a variable.
> >>> Anyway, property-placeholder doesn't seem to me to be a good option as
> >> some
> >>> of the variables inside my cfg file are seen, some aren't. For example
> I
> >>> get this:
> >>>
> >>> Error creating bean with name 'ftpClientFactory' defined in URL
> >>>
> >>
> [bundle://afa89085-51c4-4cb3-a419-afeccd70a35f_304.0:0/OSGI-INF/blueprint/spring-conf/spring-context.xml]:
> >>> Initialization of bean failed; nested exception is
> >>> org.springframework.beans.TypeMismatchException: Failed to convert
> >> property
> >>> value of type 'java.lang.String' to required type 'int' for property
> >>> 'reconnectRetries'; nested exception is
> java.lang.NumberFormatException:
> >>> For input string: "{{reconnect.retries}}"
> >>>
> >>> In the same spring context, another variable (which is present in the
> >> same
> >>> configuration file) is well referenced.
> >>>
> >>> Thanks,
> >>> Andrei M.
> >>>
> >>>> On Thu, Sep 16, 2021 at 4:12 PM John Taylor <jt...@gmail.com>
> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> A single property-placeholder is only going to allow one backing
> >>>> persistent-id.
> >>>> You can instead create multiple property-placeholders with different
> >> ids,
> >>>> e.g.
> >>>> <cm:property-placeholder id="propertiesBean" persistent-id=">. . .
> >>>> <cm:property-placeholder id="edigrid.cluster" persistent-id=" >. . .
> >>>>
> >>>> see
> >>>>
> >>>>
> >>
> https://stackoverflow.com/questions/50354932/how-to-use-multiple-property-placeholder-in-jboss-fuse-blueprint
> >>>>
> >>>> Hope that helps.
> >>>> -John
> >>>>
> >>>> On Thu, Sep 16, 2021 at 7:58 AM Andrei Petru Mura <
> mapandrei@gmail.com>
> >>>> wrote:
> >>>>
> >>>>> Hi all,
> >>>>>
> >>>>> I'm trying to migrate my camel routes from an older karaf using
> >> Spring-DM
> >>>>> to a newer one using Blueprint. For this, I intend to import my
> spring
> >>>> XML
> >>>>> configuration in my blueprint XML file. The camel context is defined
> in
> >>>> the
> >>>>> blueprint XML file.
> >>>>> Currently I'm stuck with a placeholder issue. I'm trying to import
> some
> >>>>> configuration properties from OSGI environment which are stored in a
> >> few
> >>>>> files under the ${karaf.home}/etc directory.
> >>>>> I tried many ways according to this documentation page (
> >>>>> https://camel.apache.org/components/2.x/properties-component.html),
> >> but
> >>>>> still not getting the functionality which I want.
> >>>>>
> >>>>> On short, I want to be able to define in my XML files (blueprint,
> >> spring)
> >>>>> some default values for some properties, overriding them with the
> >>>>> configurations found in the configuration files from
> ${karaf.home}/etc/
> >>>> and
> >>>>> be able to use them in in both blueprint XML and spring XML files.
> >>>>> Preferable by ${variableName}.
> >>>>>
> >>>>> Currently, I did this:
> >>>>>
> >>>>> Blueprint XML:
> >>>>>
> >>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> >>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>>>> xmlns:bean="http://www.springframework.org/schema/beans"
> >>>>> xmlns:camel="http://camel.apache.org/schema/spring"
> >>>>> xmlns:osgix="
> >> http://www.springframework.org/schema/osgi-compendium"
> >>>>> xmlns:cm="
> >>>> http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
> >>>>> xsi:schemaLocation="
> >>>>> http://www.springframework.org/schema/beans
> >>>>> http://www.springframework.org/schema/beans/spring-beans.xsd
> >>>>> http://camel.apache.org/schema/spring
> >>>>> http://camel.apache.org/schema/spring/camel-spring.xsd
> >>>>> http://www.springframework.org/schema/osgi-compendium
> >>>>>
> >>>>>
> >>>>
> >>
> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
> >>>>> ">
> >>>>>
> >>>>> <cm:property-placeholder id="propertiesBean"
> >>>>> persistent-id="edigrid.persistence,edigrid.server.id
> >>>>> ,edigrid.cluster,edigrid.ftpconfig,edigrid.reports">
> >>>>> <cm:default-properties>...</cm:default-properties>
> >>>>> </cm:property-placeholder>
> >>>>>
> >>>>> ...
> >>>>>
> >>>>> <camelContext ...>
> >>>>> <route ...>
> >>>>> ... accessing ${configVarHere1}
> >>>>> </route>
> >>>>> </camelContext>
> >>>>> </blueprint>
> >>>>>
> >>>>> <beans xmlns="http://www.springframework.org/schema/beans"
> >>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>>>> xmlns:ctx="http://www.springframework.org/schema/context"
> >>>>> xsi:schemaLocation="http://www.springframework.org/schema/beans
> >>>>> http://www.springframework.org/schema/beans/spring-beans.xsd
> >>>>> http://www.springframework.org/schema/context
> >>>>> http://www.springframework.org/schema/context/spring-context.xsd">
> >>>>>
> >>>>> <beans>
> >>>>>
> >>>>> <bean id="bridgePropertyPlaceholder"
> >>>>>
> >> class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
> >>>>> </bean>
> >>>>>
> >>>>> ...accessing ${configVarHere2}
> >>>>> </beans>
> >>>>> </beans>
> >>>>>
> >>>>> I get this kind of error (because of spring XML):
> >>>>> Failed to convert property value of type 'java.lang.String' to
> required
> >>>>> type 'int' for property 'configPropName'; nested exception is
> >>>>> java.lang.NumberFormatException: For input string:
> "${configProprName}"
> >>>>>
> >>>>> after I get a few messages like:
> >>>>> The property placeholder processor for ${, } in bundle
> >>>>> bundleName/BundleVersion found an immutable Constructor Argument at
> >>>>> location Bean named beanName->Argument index -1 and value type
> null->.
> >>>> This
> >>>>> may prevent properties, beans, or other items referenced by this
> >>>> component
> >>>>> from being properly processed.
> >>>>>
> >>>>> Any idea how I can solve my issue?
> >>>>>
> >>>>> Thanks,
> >>>>> Mura Andrei
> >>>>>
> >>>>
> >>>
> >>
>
>
Re: Using Camel, Blueprint (Aries), OSGI and Spring - Place holder issue
Posted by JB Onofré <jb...@nanthrax.net>.
Cm means that it’s backed with ConfigAdmin, so it uses metatype.
So my question is: what backend do you want : configadmin, file, … ?
Regards
JB
> Le 17 sept. 2021 à 07:50, Andrei Petru Mura <ma...@gmail.com> a écrit :
>
> Hi Jean,
>
> I think I provided a flat aries blueprint property placeholder backed with
> a file in my initial mail. Maybe I don't understand what a "flat aries
> blueprint property placeholder" is.
>
> Thanks,
> Andrei
>> On Thu, Sep 16, 2021 at 5:49 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
>> wrote:
>>
>> You can use a flat aries blueprint property placeholder backed with
>> ConfigAdmin or a file.
>>
>> Is it what you want ?
>>
>> Regards
>> JB
>>
>>> On 16/09/2021 15:46, Andrei Petru Mura wrote:
>>> This definitely isn't a good option as I don't intend to make a
>> difference
>>> by the way in which I reference a variable.
>>> Anyway, property-placeholder doesn't seem to me to be a good option as
>> some
>>> of the variables inside my cfg file are seen, some aren't. For example I
>>> get this:
>>>
>>> Error creating bean with name 'ftpClientFactory' defined in URL
>>>
>> [bundle://afa89085-51c4-4cb3-a419-afeccd70a35f_304.0:0/OSGI-INF/blueprint/spring-conf/spring-context.xml]:
>>> Initialization of bean failed; nested exception is
>>> org.springframework.beans.TypeMismatchException: Failed to convert
>> property
>>> value of type 'java.lang.String' to required type 'int' for property
>>> 'reconnectRetries'; nested exception is java.lang.NumberFormatException:
>>> For input string: "{{reconnect.retries}}"
>>>
>>> In the same spring context, another variable (which is present in the
>> same
>>> configuration file) is well referenced.
>>>
>>> Thanks,
>>> Andrei M.
>>>
>>>> On Thu, Sep 16, 2021 at 4:12 PM John Taylor <jt...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> A single property-placeholder is only going to allow one backing
>>>> persistent-id.
>>>> You can instead create multiple property-placeholders with different
>> ids,
>>>> e.g.
>>>> <cm:property-placeholder id="propertiesBean" persistent-id=">. . .
>>>> <cm:property-placeholder id="edigrid.cluster" persistent-id=" >. . .
>>>>
>>>> see
>>>>
>>>>
>> https://stackoverflow.com/questions/50354932/how-to-use-multiple-property-placeholder-in-jboss-fuse-blueprint
>>>>
>>>> Hope that helps.
>>>> -John
>>>>
>>>> On Thu, Sep 16, 2021 at 7:58 AM Andrei Petru Mura <ma...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I'm trying to migrate my camel routes from an older karaf using
>> Spring-DM
>>>>> to a newer one using Blueprint. For this, I intend to import my spring
>>>> XML
>>>>> configuration in my blueprint XML file. The camel context is defined in
>>>> the
>>>>> blueprint XML file.
>>>>> Currently I'm stuck with a placeholder issue. I'm trying to import some
>>>>> configuration properties from OSGI environment which are stored in a
>> few
>>>>> files under the ${karaf.home}/etc directory.
>>>>> I tried many ways according to this documentation page (
>>>>> https://camel.apache.org/components/2.x/properties-component.html),
>> but
>>>>> still not getting the functionality which I want.
>>>>>
>>>>> On short, I want to be able to define in my XML files (blueprint,
>> spring)
>>>>> some default values for some properties, overriding them with the
>>>>> configurations found in the configuration files from ${karaf.home}/etc/
>>>> and
>>>>> be able to use them in in both blueprint XML and spring XML files.
>>>>> Preferable by ${variableName}.
>>>>>
>>>>> Currently, I did this:
>>>>>
>>>>> Blueprint XML:
>>>>>
>>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>> xmlns:bean="http://www.springframework.org/schema/beans"
>>>>> xmlns:camel="http://camel.apache.org/schema/spring"
>>>>> xmlns:osgix="
>> http://www.springframework.org/schema/osgi-compendium"
>>>>> xmlns:cm="
>>>> http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
>>>>> xsi:schemaLocation="
>>>>> http://www.springframework.org/schema/beans
>>>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>>>> http://camel.apache.org/schema/spring
>>>>> http://camel.apache.org/schema/spring/camel-spring.xsd
>>>>> http://www.springframework.org/schema/osgi-compendium
>>>>>
>>>>>
>>>>
>> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
>>>>> ">
>>>>>
>>>>> <cm:property-placeholder id="propertiesBean"
>>>>> persistent-id="edigrid.persistence,edigrid.server.id
>>>>> ,edigrid.cluster,edigrid.ftpconfig,edigrid.reports">
>>>>> <cm:default-properties>...</cm:default-properties>
>>>>> </cm:property-placeholder>
>>>>>
>>>>> ...
>>>>>
>>>>> <camelContext ...>
>>>>> <route ...>
>>>>> ... accessing ${configVarHere1}
>>>>> </route>
>>>>> </camelContext>
>>>>> </blueprint>
>>>>>
>>>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>> xmlns:ctx="http://www.springframework.org/schema/context"
>>>>> xsi:schemaLocation="http://www.springframework.org/schema/beans
>>>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>>>> http://www.springframework.org/schema/context
>>>>> http://www.springframework.org/schema/context/spring-context.xsd">
>>>>>
>>>>> <beans>
>>>>>
>>>>> <bean id="bridgePropertyPlaceholder"
>>>>>
>> class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
>>>>> </bean>
>>>>>
>>>>> ...accessing ${configVarHere2}
>>>>> </beans>
>>>>> </beans>
>>>>>
>>>>> I get this kind of error (because of spring XML):
>>>>> Failed to convert property value of type 'java.lang.String' to required
>>>>> type 'int' for property 'configPropName'; nested exception is
>>>>> java.lang.NumberFormatException: For input string: "${configProprName}"
>>>>>
>>>>> after I get a few messages like:
>>>>> The property placeholder processor for ${, } in bundle
>>>>> bundleName/BundleVersion found an immutable Constructor Argument at
>>>>> location Bean named beanName->Argument index -1 and value type null->.
>>>> This
>>>>> may prevent properties, beans, or other items referenced by this
>>>> component
>>>>> from being properly processed.
>>>>>
>>>>> Any idea how I can solve my issue?
>>>>>
>>>>> Thanks,
>>>>> Mura Andrei
>>>>>
>>>>
>>>
>>
Re: Using Camel, Blueprint (Aries), OSGI and Spring - Place holder issue
Posted by Andrei Petru Mura <ma...@gmail.com>.
Hi Jean,
I think I provided a flat aries blueprint property placeholder backed with
a file in my initial mail. Maybe I don't understand what a "flat aries
blueprint property placeholder" is.
Thanks,
Andrei
On Thu, Sep 16, 2021 at 5:49 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
wrote:
> You can use a flat aries blueprint property placeholder backed with
> ConfigAdmin or a file.
>
> Is it what you want ?
>
> Regards
> JB
>
> On 16/09/2021 15:46, Andrei Petru Mura wrote:
> > This definitely isn't a good option as I don't intend to make a
> difference
> > by the way in which I reference a variable.
> > Anyway, property-placeholder doesn't seem to me to be a good option as
> some
> > of the variables inside my cfg file are seen, some aren't. For example I
> > get this:
> >
> > Error creating bean with name 'ftpClientFactory' defined in URL
> >
> [bundle://afa89085-51c4-4cb3-a419-afeccd70a35f_304.0:0/OSGI-INF/blueprint/spring-conf/spring-context.xml]:
> > Initialization of bean failed; nested exception is
> > org.springframework.beans.TypeMismatchException: Failed to convert
> property
> > value of type 'java.lang.String' to required type 'int' for property
> > 'reconnectRetries'; nested exception is java.lang.NumberFormatException:
> > For input string: "{{reconnect.retries}}"
> >
> > In the same spring context, another variable (which is present in the
> same
> > configuration file) is well referenced.
> >
> > Thanks,
> > Andrei M.
> >
> > On Thu, Sep 16, 2021 at 4:12 PM John Taylor <jt...@gmail.com> wrote:
> >
> >> Hi,
> >>
> >> A single property-placeholder is only going to allow one backing
> >> persistent-id.
> >> You can instead create multiple property-placeholders with different
> ids,
> >> e.g.
> >> <cm:property-placeholder id="propertiesBean" persistent-id=">. . .
> >> <cm:property-placeholder id="edigrid.cluster" persistent-id=" >. . .
> >>
> >> see
> >>
> >>
> https://stackoverflow.com/questions/50354932/how-to-use-multiple-property-placeholder-in-jboss-fuse-blueprint
> >>
> >> Hope that helps.
> >> -John
> >>
> >> On Thu, Sep 16, 2021 at 7:58 AM Andrei Petru Mura <ma...@gmail.com>
> >> wrote:
> >>
> >>> Hi all,
> >>>
> >>> I'm trying to migrate my camel routes from an older karaf using
> Spring-DM
> >>> to a newer one using Blueprint. For this, I intend to import my spring
> >> XML
> >>> configuration in my blueprint XML file. The camel context is defined in
> >> the
> >>> blueprint XML file.
> >>> Currently I'm stuck with a placeholder issue. I'm trying to import some
> >>> configuration properties from OSGI environment which are stored in a
> few
> >>> files under the ${karaf.home}/etc directory.
> >>> I tried many ways according to this documentation page (
> >>> https://camel.apache.org/components/2.x/properties-component.html),
> but
> >>> still not getting the functionality which I want.
> >>>
> >>> On short, I want to be able to define in my XML files (blueprint,
> spring)
> >>> some default values for some properties, overriding them with the
> >>> configurations found in the configuration files from ${karaf.home}/etc/
> >> and
> >>> be able to use them in in both blueprint XML and spring XML files.
> >>> Preferable by ${variableName}.
> >>>
> >>> Currently, I did this:
> >>>
> >>> Blueprint XML:
> >>>
> >>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>> xmlns:bean="http://www.springframework.org/schema/beans"
> >>> xmlns:camel="http://camel.apache.org/schema/spring"
> >>> xmlns:osgix="
> http://www.springframework.org/schema/osgi-compendium"
> >>> xmlns:cm="
> >> http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
> >>> xsi:schemaLocation="
> >>> http://www.springframework.org/schema/beans
> >>> http://www.springframework.org/schema/beans/spring-beans.xsd
> >>> http://camel.apache.org/schema/spring
> >>> http://camel.apache.org/schema/spring/camel-spring.xsd
> >>> http://www.springframework.org/schema/osgi-compendium
> >>>
> >>>
> >>
> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
> >>> ">
> >>>
> >>> <cm:property-placeholder id="propertiesBean"
> >>> persistent-id="edigrid.persistence,edigrid.server.id
> >>> ,edigrid.cluster,edigrid.ftpconfig,edigrid.reports">
> >>> <cm:default-properties>...</cm:default-properties>
> >>> </cm:property-placeholder>
> >>>
> >>> ...
> >>>
> >>> <camelContext ...>
> >>> <route ...>
> >>> ... accessing ${configVarHere1}
> >>> </route>
> >>> </camelContext>
> >>> </blueprint>
> >>>
> >>> <beans xmlns="http://www.springframework.org/schema/beans"
> >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>> xmlns:ctx="http://www.springframework.org/schema/context"
> >>> xsi:schemaLocation="http://www.springframework.org/schema/beans
> >>> http://www.springframework.org/schema/beans/spring-beans.xsd
> >>> http://www.springframework.org/schema/context
> >>> http://www.springframework.org/schema/context/spring-context.xsd">
> >>>
> >>> <beans>
> >>>
> >>> <bean id="bridgePropertyPlaceholder"
> >>>
> class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
> >>> </bean>
> >>>
> >>> ...accessing ${configVarHere2}
> >>> </beans>
> >>> </beans>
> >>>
> >>> I get this kind of error (because of spring XML):
> >>> Failed to convert property value of type 'java.lang.String' to required
> >>> type 'int' for property 'configPropName'; nested exception is
> >>> java.lang.NumberFormatException: For input string: "${configProprName}"
> >>>
> >>> after I get a few messages like:
> >>> The property placeholder processor for ${, } in bundle
> >>> bundleName/BundleVersion found an immutable Constructor Argument at
> >>> location Bean named beanName->Argument index -1 and value type null->.
> >> This
> >>> may prevent properties, beans, or other items referenced by this
> >> component
> >>> from being properly processed.
> >>>
> >>> Any idea how I can solve my issue?
> >>>
> >>> Thanks,
> >>> Mura Andrei
> >>>
> >>
> >
>
Re: Using Camel, Blueprint (Aries), OSGI and Spring - Place holder
issue
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
You can use a flat aries blueprint property placeholder backed with
ConfigAdmin or a file.
Is it what you want ?
Regards
JB
On 16/09/2021 15:46, Andrei Petru Mura wrote:
> This definitely isn't a good option as I don't intend to make a difference
> by the way in which I reference a variable.
> Anyway, property-placeholder doesn't seem to me to be a good option as some
> of the variables inside my cfg file are seen, some aren't. For example I
> get this:
>
> Error creating bean with name 'ftpClientFactory' defined in URL
> [bundle://afa89085-51c4-4cb3-a419-afeccd70a35f_304.0:0/OSGI-INF/blueprint/spring-conf/spring-context.xml]:
> Initialization of bean failed; nested exception is
> org.springframework.beans.TypeMismatchException: Failed to convert property
> value of type 'java.lang.String' to required type 'int' for property
> 'reconnectRetries'; nested exception is java.lang.NumberFormatException:
> For input string: "{{reconnect.retries}}"
>
> In the same spring context, another variable (which is present in the same
> configuration file) is well referenced.
>
> Thanks,
> Andrei M.
>
> On Thu, Sep 16, 2021 at 4:12 PM John Taylor <jt...@gmail.com> wrote:
>
>> Hi,
>>
>> A single property-placeholder is only going to allow one backing
>> persistent-id.
>> You can instead create multiple property-placeholders with different ids,
>> e.g.
>> <cm:property-placeholder id="propertiesBean" persistent-id=">. . .
>> <cm:property-placeholder id="edigrid.cluster" persistent-id=" >. . .
>>
>> see
>>
>> https://stackoverflow.com/questions/50354932/how-to-use-multiple-property-placeholder-in-jboss-fuse-blueprint
>>
>> Hope that helps.
>> -John
>>
>> On Thu, Sep 16, 2021 at 7:58 AM Andrei Petru Mura <ma...@gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> I'm trying to migrate my camel routes from an older karaf using Spring-DM
>>> to a newer one using Blueprint. For this, I intend to import my spring
>> XML
>>> configuration in my blueprint XML file. The camel context is defined in
>> the
>>> blueprint XML file.
>>> Currently I'm stuck with a placeholder issue. I'm trying to import some
>>> configuration properties from OSGI environment which are stored in a few
>>> files under the ${karaf.home}/etc directory.
>>> I tried many ways according to this documentation page (
>>> https://camel.apache.org/components/2.x/properties-component.html), but
>>> still not getting the functionality which I want.
>>>
>>> On short, I want to be able to define in my XML files (blueprint, spring)
>>> some default values for some properties, overriding them with the
>>> configurations found in the configuration files from ${karaf.home}/etc/
>> and
>>> be able to use them in in both blueprint XML and spring XML files.
>>> Preferable by ${variableName}.
>>>
>>> Currently, I did this:
>>>
>>> Blueprint XML:
>>>
>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:bean="http://www.springframework.org/schema/beans"
>>> xmlns:camel="http://camel.apache.org/schema/spring"
>>> xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
>>> xmlns:cm="
>> http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
>>> xsi:schemaLocation="
>>> http://www.springframework.org/schema/beans
>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>> http://camel.apache.org/schema/spring
>>> http://camel.apache.org/schema/spring/camel-spring.xsd
>>> http://www.springframework.org/schema/osgi-compendium
>>>
>>>
>> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
>>> ">
>>>
>>> <cm:property-placeholder id="propertiesBean"
>>> persistent-id="edigrid.persistence,edigrid.server.id
>>> ,edigrid.cluster,edigrid.ftpconfig,edigrid.reports">
>>> <cm:default-properties>...</cm:default-properties>
>>> </cm:property-placeholder>
>>>
>>> ...
>>>
>>> <camelContext ...>
>>> <route ...>
>>> ... accessing ${configVarHere1}
>>> </route>
>>> </camelContext>
>>> </blueprint>
>>>
>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:ctx="http://www.springframework.org/schema/context"
>>> xsi:schemaLocation="http://www.springframework.org/schema/beans
>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>> http://www.springframework.org/schema/context
>>> http://www.springframework.org/schema/context/spring-context.xsd">
>>>
>>> <beans>
>>>
>>> <bean id="bridgePropertyPlaceholder"
>>> class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
>>> </bean>
>>>
>>> ...accessing ${configVarHere2}
>>> </beans>
>>> </beans>
>>>
>>> I get this kind of error (because of spring XML):
>>> Failed to convert property value of type 'java.lang.String' to required
>>> type 'int' for property 'configPropName'; nested exception is
>>> java.lang.NumberFormatException: For input string: "${configProprName}"
>>>
>>> after I get a few messages like:
>>> The property placeholder processor for ${, } in bundle
>>> bundleName/BundleVersion found an immutable Constructor Argument at
>>> location Bean named beanName->Argument index -1 and value type null->.
>> This
>>> may prevent properties, beans, or other items referenced by this
>> component
>>> from being properly processed.
>>>
>>> Any idea how I can solve my issue?
>>>
>>> Thanks,
>>> Mura Andrei
>>>
>>
>
Re: Using Camel, Blueprint (Aries), OSGI and Spring - Place holder issue
Posted by Andrei Petru Mura <ma...@gmail.com>.
This definitely isn't a good option as I don't intend to make a difference
by the way in which I reference a variable.
Anyway, property-placeholder doesn't seem to me to be a good option as some
of the variables inside my cfg file are seen, some aren't. For example I
get this:
Error creating bean with name 'ftpClientFactory' defined in URL
[bundle://afa89085-51c4-4cb3-a419-afeccd70a35f_304.0:0/OSGI-INF/blueprint/spring-conf/spring-context.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.TypeMismatchException: Failed to convert property
value of type 'java.lang.String' to required type 'int' for property
'reconnectRetries'; nested exception is java.lang.NumberFormatException:
For input string: "{{reconnect.retries}}"
In the same spring context, another variable (which is present in the same
configuration file) is well referenced.
Thanks,
Andrei M.
On Thu, Sep 16, 2021 at 4:12 PM John Taylor <jt...@gmail.com> wrote:
> Hi,
>
> A single property-placeholder is only going to allow one backing
> persistent-id.
> You can instead create multiple property-placeholders with different ids,
> e.g.
> <cm:property-placeholder id="propertiesBean" persistent-id=">. . .
> <cm:property-placeholder id="edigrid.cluster" persistent-id=" >. . .
>
> see
>
> https://stackoverflow.com/questions/50354932/how-to-use-multiple-property-placeholder-in-jboss-fuse-blueprint
>
> Hope that helps.
> -John
>
> On Thu, Sep 16, 2021 at 7:58 AM Andrei Petru Mura <ma...@gmail.com>
> wrote:
>
> > Hi all,
> >
> > I'm trying to migrate my camel routes from an older karaf using Spring-DM
> > to a newer one using Blueprint. For this, I intend to import my spring
> XML
> > configuration in my blueprint XML file. The camel context is defined in
> the
> > blueprint XML file.
> > Currently I'm stuck with a placeholder issue. I'm trying to import some
> > configuration properties from OSGI environment which are stored in a few
> > files under the ${karaf.home}/etc directory.
> > I tried many ways according to this documentation page (
> > https://camel.apache.org/components/2.x/properties-component.html), but
> > still not getting the functionality which I want.
> >
> > On short, I want to be able to define in my XML files (blueprint, spring)
> > some default values for some properties, overriding them with the
> > configurations found in the configuration files from ${karaf.home}/etc/
> and
> > be able to use them in in both blueprint XML and spring XML files.
> > Preferable by ${variableName}.
> >
> > Currently, I did this:
> >
> > Blueprint XML:
> >
> > <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:bean="http://www.springframework.org/schema/beans"
> > xmlns:camel="http://camel.apache.org/schema/spring"
> > xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
> > xmlns:cm="
> http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
> > xsi:schemaLocation="
> > http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> > http://camel.apache.org/schema/spring
> > http://camel.apache.org/schema/spring/camel-spring.xsd
> > http://www.springframework.org/schema/osgi-compendium
> >
> >
> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
> > ">
> >
> > <cm:property-placeholder id="propertiesBean"
> > persistent-id="edigrid.persistence,edigrid.server.id
> > ,edigrid.cluster,edigrid.ftpconfig,edigrid.reports">
> > <cm:default-properties>...</cm:default-properties>
> > </cm:property-placeholder>
> >
> > ...
> >
> > <camelContext ...>
> > <route ...>
> > ... accessing ${configVarHere1}
> > </route>
> > </camelContext>
> > </blueprint>
> >
> > <beans xmlns="http://www.springframework.org/schema/beans"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:ctx="http://www.springframework.org/schema/context"
> > xsi:schemaLocation="http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> > http://www.springframework.org/schema/context
> > http://www.springframework.org/schema/context/spring-context.xsd">
> >
> > <beans>
> >
> > <bean id="bridgePropertyPlaceholder"
> > class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
> > </bean>
> >
> > ...accessing ${configVarHere2}
> > </beans>
> > </beans>
> >
> > I get this kind of error (because of spring XML):
> > Failed to convert property value of type 'java.lang.String' to required
> > type 'int' for property 'configPropName'; nested exception is
> > java.lang.NumberFormatException: For input string: "${configProprName}"
> >
> > after I get a few messages like:
> > The property placeholder processor for ${, } in bundle
> > bundleName/BundleVersion found an immutable Constructor Argument at
> > location Bean named beanName->Argument index -1 and value type null->.
> This
> > may prevent properties, beans, or other items referenced by this
> component
> > from being properly processed.
> >
> > Any idea how I can solve my issue?
> >
> > Thanks,
> > Mura Andrei
> >
>
Re: Using Camel, Blueprint (Aries), OSGI and Spring - Place holder issue
Posted by John Taylor <jt...@gmail.com>.
Hi,
A single property-placeholder is only going to allow one backing
persistent-id.
You can instead create multiple property-placeholders with different ids,
e.g.
<cm:property-placeholder id="propertiesBean" persistent-id=">. . .
<cm:property-placeholder id="edigrid.cluster" persistent-id=" >. . .
see
https://stackoverflow.com/questions/50354932/how-to-use-multiple-property-placeholder-in-jboss-fuse-blueprint
Hope that helps.
-John
On Thu, Sep 16, 2021 at 7:58 AM Andrei Petru Mura <ma...@gmail.com>
wrote:
> Hi all,
>
> I'm trying to migrate my camel routes from an older karaf using Spring-DM
> to a newer one using Blueprint. For this, I intend to import my spring XML
> configuration in my blueprint XML file. The camel context is defined in the
> blueprint XML file.
> Currently I'm stuck with a placeholder issue. I'm trying to import some
> configuration properties from OSGI environment which are stored in a few
> files under the ${karaf.home}/etc directory.
> I tried many ways according to this documentation page (
> https://camel.apache.org/components/2.x/properties-component.html), but
> still not getting the functionality which I want.
>
> On short, I want to be able to define in my XML files (blueprint, spring)
> some default values for some properties, overriding them with the
> configurations found in the configuration files from ${karaf.home}/etc/ and
> be able to use them in in both blueprint XML and spring XML files.
> Preferable by ${variableName}.
>
> Currently, I did this:
>
> Blueprint XML:
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:bean="http://www.springframework.org/schema/beans"
> xmlns:camel="http://camel.apache.org/schema/spring"
> xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd
> http://www.springframework.org/schema/osgi-compendium
>
> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
> ">
>
> <cm:property-placeholder id="propertiesBean"
> persistent-id="edigrid.persistence,edigrid.server.id
> ,edigrid.cluster,edigrid.ftpconfig,edigrid.reports">
> <cm:default-properties>...</cm:default-properties>
> </cm:property-placeholder>
>
> ...
>
> <camelContext ...>
> <route ...>
> ... accessing ${configVarHere1}
> </route>
> </camelContext>
> </blueprint>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ctx="http://www.springframework.org/schema/context"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context.xsd">
>
> <beans>
>
> <bean id="bridgePropertyPlaceholder"
> class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
> </bean>
>
> ...accessing ${configVarHere2}
> </beans>
> </beans>
>
> I get this kind of error (because of spring XML):
> Failed to convert property value of type 'java.lang.String' to required
> type 'int' for property 'configPropName'; nested exception is
> java.lang.NumberFormatException: For input string: "${configProprName}"
>
> after I get a few messages like:
> The property placeholder processor for ${, } in bundle
> bundleName/BundleVersion found an immutable Constructor Argument at
> location Bean named beanName->Argument index -1 and value type null->. This
> may prevent properties, beans, or other items referenced by this component
> from being properly processed.
>
> Any idea how I can solve my issue?
>
> Thanks,
> Mura Andrei
>