You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by lekkie <le...@gmail.com> on 2010/06/03 11:06:30 UTC

Using properties file values with Camel Simple expression

I am trying to insert a value from a properties file into a simple expression
but it keeps throwing an exception

<route>
	<from uri="direct:signOut"/>
    	<transform>			
		<simple>${properties:my-host}</simple>
	</transform>
    	<to uri="nmr:HTTPService"/>
</route>

See exception below:

org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route
route56 at: >>> Transform[simple{${properties:my-host}}] <<< in route:
Route[[From[direct://signOut]] -> [Transform[simple{%3CAK_BS... because of
Illegal syntax: properties:aero-host
	at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1055)
	at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
	at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:593)
	at
org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
	at
org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
	at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
	at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
	at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)

	... 12 more
Caused by: org.apache.camel.ExpressionIllegalSyntaxException: Illegal
syntax: properties:my-host
	at
org.apache.camel.language.simple.SimpleLanguage.createSimpleExpression(SimpleLanguage.java:155)
	at
org.apache.camel.language.simple.SimpleLanguageSupport.createComplexConcatExpression(SimpleLanguageSupport.java:267)
	at
org.apache.camel.language.simple.SimpleLanguageSupport.createExpression(SimpleLanguageSupport.java:69)
	at
org.apache.camel.model.language.ExpressionDefinition.createExpression(ExpressionDefinition.java:171)
	at
org.apache.camel.model.language.ExpressionDefinition.createExpression(ExpressionDefinition.java:161)
	at
org.apache.camel.model.TransformDefinition.createProcessor(TransformDefinition.java:55)
	at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:325)
	at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:137)
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:690)
	... 22 more


I went through the doc on http://camel.apache.org/simple.html and I saw
this:

properties:locations:key 	 String 	 Camel 2.3: Lookup a property with the
given key. The locations option is optional. See more at Using
PropertyPlaceholder. 

I wonder what the proble is.

regards.
-- 
View this message in context: http://old.nabble.com/Using-properties-file-values-with-Camel-Simple-expression-tp28764989p28764989.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Using properties file values with Camel Simple expression

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You need Camel 2.3 for that !!!



On Thu, Jun 3, 2010 at 11:06 AM, lekkie <le...@gmail.com> wrote:
>
> I am trying to insert a value from a properties file into a simple expression
> but it keeps throwing an exception
>
> <route>
>        <from uri="direct:signOut"/>
>        <transform>
>                <simple>${properties:my-host}</simple>
>        </transform>
>        <to uri="nmr:HTTPService"/>
> </route>
>
> See exception below:
>
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.FailedToCreateRouteException: Failed to create route
> route56 at: >>> Transform[simple{${properties:my-host}}] <<< in route:
> Route[[From[direct://signOut]] -> [Transform[simple{%3CAK_BS... because of
> Illegal syntax: properties:aero-host
>        at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1055)
>        at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
>        at
> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:593)
>        at
> org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
>        at
> org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
>        at
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
>        at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
>        at
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
>
>        ... 12 more
> Caused by: org.apache.camel.ExpressionIllegalSyntaxException: Illegal
> syntax: properties:my-host
>        at
> org.apache.camel.language.simple.SimpleLanguage.createSimpleExpression(SimpleLanguage.java:155)
>        at
> org.apache.camel.language.simple.SimpleLanguageSupport.createComplexConcatExpression(SimpleLanguageSupport.java:267)
>        at
> org.apache.camel.language.simple.SimpleLanguageSupport.createExpression(SimpleLanguageSupport.java:69)
>        at
> org.apache.camel.model.language.ExpressionDefinition.createExpression(ExpressionDefinition.java:171)
>        at
> org.apache.camel.model.language.ExpressionDefinition.createExpression(ExpressionDefinition.java:161)
>        at
> org.apache.camel.model.TransformDefinition.createProcessor(TransformDefinition.java:55)
>        at
> org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:325)
>        at
> org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:137)
>        at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:690)
>        ... 22 more
>
>
> I went through the doc on http://camel.apache.org/simple.html and I saw
> this:
>
> properties:locations:key         String          Camel 2.3: Lookup a property with the
> given key. The locations option is optional. See more at Using
> PropertyPlaceholder.
>
> I wonder what the proble is.
>
> regards.
> --
> View this message in context: http://old.nabble.com/Using-properties-file-values-with-Camel-Simple-expression-tp28764989p28764989.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus