You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by javaxmlsoapdev <ja...@yahoo.com> on 2012/05/18 15:07:18 UTC
Unable to read properties from camel PropertiesComponent
I have defined "properties" bean of type camel PropertiesComponent as shown
below. "my.properties" has
threadPool.defaultSize and threadPool.maxPoolSize properties defined.
However camel threadPoolProfile isn't able to recognize those properties and
keep complaining as follow.
Any idea?
<bean id="properties"
class="org.apache.camel.component.properties.PropertiesComponent">
<property name="location" value="classpath:my.properties" />
</bean>
<camel:camelContext id="camelContext">
<camel:contextScan></camel:contextScan>
<camel:threadPoolProfile defaultProfile="true"
id="customThreadPool" poolSize="threadPool.defaultPoolSize"
maxPoolSize="threadPool.maxPoolSize" />
</camel:camelContext>
Caused by: java.lang.NumberFormatException: For input string:
"threadPool.defaultPoolSize"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Integer.valueOf(Integer.java:553)
at
org.apache.camel.converter.ObjectConverter.toInteger(ObjectConverter.java:250)
--
View this message in context: http://camel.465427.n5.nabble.com/Unable-to-read-properties-from-camel-PropertiesComponent-tp5711888.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Unable to read properties from camel PropertiesComponent
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
This should work, see for example the
SpringCamelContextThreadPoolProfilesWithPlaceholderTest.xml from the
unit tests of camel-spring.
On Fri, May 18, 2012 at 5:58 PM, javaxmlsoapdev
<ja...@yahoo.com> wrote:
> camel doesn't recognize spring property format ${} doesn't work. Also look at
> this post where user was able to use camel property component
> http://grokbase.com/t/camel/users/122gn6jvjq/property-placeholder
>
> Following camel link also suggests we don't need to put {{ }}
> http://camel.apache.org/properties.html
>
>
>
> I am fine to get rid of camel property component completely if somehow I can
> pass spring property to following..(I know that's not a valid syntax but
> imagining something like it)
>
> <camel:threadPoolProfile defaultProfile="true"
> id="customThreadPool"
> poolSize=${threadPool.defaultPoolSize}
> maxPoolSize=${threadPool.maxPoolSize}
> />
>
>
> Any ideas?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Unable-to-read-properties-from-camel-PropertiesComponent-tp5711888p5712002.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Unable to read properties from camel PropertiesComponent
Posted by javaxmlsoapdev <ja...@yahoo.com>.
camel doesn't recognize spring property format ${} doesn't work. Also look at
this post where user was able to use camel property component
http://grokbase.com/t/camel/users/122gn6jvjq/property-placeholder
Following camel link also suggests we don't need to put {{ }}
http://camel.apache.org/properties.html
I am fine to get rid of camel property component completely if somehow I can
pass spring property to following..(I know that's not a valid syntax but
imagining something like it)
<camel:threadPoolProfile defaultProfile="true"
id="customThreadPool"
poolSize=${threadPool.defaultPoolSize}
maxPoolSize=${threadPool.maxPoolSize}
/>
Any ideas?
--
View this message in context: http://camel.465427.n5.nabble.com/Unable-to-read-properties-from-camel-PropertiesComponent-tp5711888p5712002.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Unable to read properties from camel PropertiesComponent
Posted by Vincent Nonnenmacher <vi...@gmail.com>.
if you use the Spring properties you need to refer to properties using the
Spring ${} interpolation syntax
but if you choose to use the Camel properties component you must use the {{
}} interpolation syntax
in that latter case its better to use the
<camelContext ...>
<propertyPlaceholder id="properties" location="classpath:<java path
to/>my.properties"/>
<camel:threadPoolProfile defaultProfile="true"
id="customThreadPool"
poolSize="{{threadPool.defaultPoolSize}}"
maxPoolSize="{{threadPool.maxPoolSize}}"
/>
</camelContext>
On Fri, May 18, 2012 at 3:07 PM, javaxmlsoapdev <ja...@yahoo.com>wrote:
> I have defined "properties" bean of type camel PropertiesComponent as shown
> below. "my.properties" has
> threadPool.defaultSize and threadPool.maxPoolSize properties defined.
> However camel threadPoolProfile isn't able to recognize those properties
> and
> keep complaining as follow.
>
> Any idea?
>
> <bean id="properties"
>
> class="org.apache.camel.component.properties.PropertiesComponent">
> <property name="location" value="classpath:my.properties" />
> </bean>
>
> <camel:camelContext id="camelContext">
>
> <camel:contextScan></camel:contextScan>
> <camel:threadPoolProfile defaultProfile="true"
> id="customThreadPool"
> poolSize="threadPool.defaultPoolSize"
> maxPoolSize="threadPool.maxPoolSize" />
> </camel:camelContext>
>
> Caused by: java.lang.NumberFormatException: For input string:
> "threadPool.defaultPoolSize"
> at
>
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> at java.lang.Integer.parseInt(Integer.java:447)
> at java.lang.Integer.valueOf(Integer.java:553)
> at
>
> org.apache.camel.converter.ObjectConverter.toInteger(ObjectConverter.java:250)
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Unable-to-read-properties-from-camel-PropertiesComponent-tp5711888.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: Unable to read properties from camel PropertiesComponent
Posted by James Carman <ja...@carmanconsulting.com>.
You need delimiters around your property name.
On Fri, May 18, 2012 at 9:07 AM, javaxmlsoapdev
<ja...@yahoo.com> wrote:
> I have defined "properties" bean of type camel PropertiesComponent as shown
> below. "my.properties" has
> threadPool.defaultSize and threadPool.maxPoolSize properties defined.
> However camel threadPoolProfile isn't able to recognize those properties and
> keep complaining as follow.
>
> Any idea?
>
> <bean id="properties"
> class="org.apache.camel.component.properties.PropertiesComponent">
> <property name="location" value="classpath:my.properties" />
> </bean>
>
> <camel:camelContext id="camelContext">
>
> <camel:contextScan></camel:contextScan>
> <camel:threadPoolProfile defaultProfile="true"
> id="customThreadPool" poolSize="threadPool.defaultPoolSize"
> maxPoolSize="threadPool.maxPoolSize" />
> </camel:camelContext>
>
> Caused by: java.lang.NumberFormatException: For input string:
> "threadPool.defaultPoolSize"
> at
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> at java.lang.Integer.parseInt(Integer.java:447)
> at java.lang.Integer.valueOf(Integer.java:553)
> at
> org.apache.camel.converter.ObjectConverter.toInteger(ObjectConverter.java:250)
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Unable-to-read-properties-from-camel-PropertiesComponent-tp5711888.html
> Sent from the Camel - Users mailing list archive at Nabble.com.