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

Reply via email to