camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-6400) CamelContext fails to start using placeholder in "simple" in conjunction with BridgePropertyPlaceholder
Date Tue, 28 May 2013 05:53:20 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-6400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13668109#comment-13668109
] 

Claus Ibsen commented on CAMEL-6400:
------------------------------------

I added a note to the docs about this clash.

                
> CamelContext fails to start using placeholder in "simple" in conjunction with BridgePropertyPlaceholder
> -------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-6400
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6400
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 2.11.0
>            Reporter: Nerses Aznauryan
>            Assignee: Claus Ibsen
>         Attachments: tests_to_reproduce_bug.patch
>
>
> Recently after upgrading from 2.10.3 to 2.11.0 I have encountered the following bug.
> The problematic part was looking like this: 
> {code}
> from("direct:start")
>     .setHeader(Exchange.FILE_NAME, simple("{{file.rootdir}}/${in.header.CamelFileName}"))
>     .to("mock:result");
> {code} 
> Camel was failing to start with the following exception
> {code}
> org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>>
SetHeader[CamelFileName, simple{Simple: {{file.rootdir}}/${in.header.CamelFileName}}] <<<
in route: Route(route1)[[From[direct:start]] -> [SetHeader[CamelFileNa... because of Could
not resolve placeholder 'in.header.CamelFileName' in string value "/root/dir/${in.header.CamelFileName}"
> 	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:883)
> 	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:176)
> 	at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:755)
> 	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1857)
> 	at org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:692)
> 	at org.apache.camel.builder.RouteBuilder.populateRoutes(RouteBuilder.java:337)
> 	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:264)
> 	at org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:654)
> 	at org.apache.camel.ContextTestSupport.setUp(ContextTestSupport.java:115)
> 	at org.apache.camel.spring.SpringTestSupport.setUp(SpringTestSupport.java:54)
> 	at org.apache.camel.TestSupport.runBare(TestSupport.java:58)
> 	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
> 	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
> 	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
> Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'in.header.CamelFileName'
in string value "/root/dir/${in.header.CamelFileName}"
> 	at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:173)
> 	at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:125)
> 	at org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer.springResolvePlaceholders(BridgePropertyPlaceholderConfigurer.java:180)
> 	at org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer.parseUri(BridgePropertyPlaceholderConfigurer.java:143)
> 	at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:161)
> 	at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:120)
> 	at org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:1100)
> 	at org.apache.camel.model.ProcessorDefinition.resolvePropertyPlaceholders(ProcessorDefinition.java:556)
> 	at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:471)
> 	at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:197)
> 	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:880)
> 	... 22 more
> {code} 
> I have created a small test to reproduce the bug, and thanks to git bisect I found the
commit that introduced this bug. It is commit ea4c0ab5 "CAMEL-6233: BridgePropertyPlaceholderConfigurer
does not support nested Spring properties". The problem is that it is trying to resolve the
whole simple with the property resolver but after resolving the spring property it treats
{{$&#123;in.header.CamelFileName&#125;}} as a spring placeholder and fails to find
it.
> There is a workaround. If {{&#123;&#123;file.rootdir&#125;&#125;}} is
replaced by {{$&#123;properties:file.rootdir&#125;}} then Camel starts just fine.
> The test to reproduce is attached.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message