You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by deepak_a <an...@gmail.com> on 2013/09/25 12:19:44 UTC

Issue with camel in Camel 2.12.0

All,

I am migrating from camel 2.9.0 to 2.12.0.
One change I had to do was around additional boolean argument added in
method resolveProperties of
org.apache.camel.component.properties.DefaultPropertiesResolver

I am also seeing the use of Expression Language failing in 2.12.0.
My Route is as follows

		<route id="downloadCsvFormSftp" reform:name="download csv file from sftp
to local"
			reform:systemName="download_csv_file_from_sftp_to_local">
			<from
			
uri="sftp://${csv.loader.sftp.user}@${csv.loader.sftp.url}?password=${csv.loader.sftp.password}&amp;binary=true&amp;delay=6000&amp;filter=#csvLoaderFilter&amp;move=.done"
/>
			<to uri="file:/opt/share/csvloader"/>
		
			<setHeader headerName="csvFileNameRegex">
                <simple>${csv.file.name.regx}</simple>
            </setHeader>
            
            <onException>
            
<exception>com.lombardrisk.reform.exception.CsvValidateException</exception>
	            <redeliveryPolicy
maximumRedeliveries="${routes.redelivery.maxRedeliveries}"
                                   
redeliveryDelay="${routes.redelivery.redeliveryDelay}"/>
	            <handled>
	                <constant>true</constant>
	            </handled>
            	<process ref="csvFileValidateFaultHandle"/>
        	</onException>
			<process ref="csvfileNameValidate"/>
			<unmarshal><csv/></unmarshal>
			<process ref="csvContentValidate"/>
			<to uri="bean:csvDataHandler?method=convertCsvData" />
			<split streaming="true"  stopOnException="true">
				* <el>${body}</el> *
				 <to uri="activemq:queue:csvRowData"/>
			</split>
        </route>

Intention is to download a CSV file from sFTP and extract each line in that
CSV and send it to a Queue.
The expression <el>${body}</el>
Throws the below error when starting the route


Exception in thread "LockManager" java.lang.RuntimeException:
org.apache.camel.FailedToCreateRouteException: Failed to create route
downloadCsvFormS
p at: >>> Split[el{${body}} -> [To[activemq:queue:csvRowData]]] <<< in
route: Route(downloadCsvFormSftp)[[From[sftp://${csv.loader.sftp.us...
becaus
of Property with key [body] not found in properties from text: ${body}
        at
com.lombardrisk.reform.integration.SpringContextManager.addRoutesIntoCamelContext(SpringContextManager.java:80)
        at
com.lombardrisk.reform.integration.DbLockManager.manageLockUsingStatement(DbLockManager.java:78)
        at
com.lombardrisk.reform.integration.DbLockManager.manageLock(DbLockManager.java:125)
        at
com.lombardrisk.reform.integration.DbLockManager.access$000(DbLockManager.java:11)
        at
com.lombardrisk.reform.integration.DbLockManager$1.run(DbLockManager.java:34)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route downloadCsvFormSftp at: >>> Split[el{${body}} -> [To[activemq:queue
svRowData]]] <<< in route:
Route(downloadCsvFormSftp)[[From[sftp://${csv.loader.sftp.us... because of
Property with key [body] not found in properti
 from text: ${body}
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:912)
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:177)
        at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:770)
        at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1914)
        at
org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:707)
        at
com.lombardrisk.reform.integration.SpringContextManager.addRoutesIntoCamelContext(SpringContextManager.java:78)
        ... 5 more
Caused by: java.lang.IllegalArgumentException: Property with key [body] not
found in properties from text: ${body}
        at
org.apache.camel.component.properties.DefaultPropertiesParser.doParseUri(DefaultPropertiesParser.java:120)
        at
org.apache.camel.component.properties.DefaultPropertiesParser.parseUri(DefaultPropertiesParser.java:51)
        at
org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:158)
        at
org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:117)
        at
org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:1128)
        at
org.apache.camel.model.ProcessorDefinition.resolvePropertyPlaceholders(ProcessorDefinition.java:572)
        at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:487)
        at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:213)
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:909)
        ... 10 more




I have tried setting it as *<el>${in.body}</el>* 
But I get the same error.
is came assuming it to be a Property and not as an expression language?

Note: I had to upgrade to 2.12.0 because of a couple of known defects around
sFTP in 2.9.0 

regards
D




--
View this message in context: http://camel.465427.n5.nabble.com/Issue-with-camel-el-in-Camel-2-12-0-tp5740188.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Issue with camel in Camel 2.12.0

Posted by deepak_a <an...@gmail.com>.
http://camel.apache.org/using-propertyplaceholder.html

Following section: *Clashing Spring property placeholders with Camels Simple
language*
in the above link explains how to avoid this problem.

Following now works fine

*			<split streaming="true"  stopOnException="true">
				 <el>$simple{body}</el> 
				 <to uri="activemq:queue:csvRowData"/>
			</split>*





--
View this message in context: http://camel.465427.n5.nabble.com/Issue-with-camel-el-in-Camel-2-12-0-tp5740188p5740193.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Issue with camel in Camel 2.12.0

Posted by deepak_a <an...@gmail.com>.
Hi,

Just retried it with Camel 2.9.0 and 
<split streaming="true"  stopOnException="true">
 <el>${body}</el> 
<split streaming="true"  stopOnException="true">

and
<split streaming="true"  stopOnException="true">
 <simple>${body}</simple> 
<split streaming="true"  stopOnException="true">

works fine.

Only in Camel 2.12.0 - it assumes that anything under ${} is a property -
and throws an exception that property value not found for the Key.

Is this a genuine defect or am I using it wrongly?

regards
D




--
View this message in context: http://camel.465427.n5.nabble.com/Issue-with-camel-el-in-Camel-2-12-0-tp5740188p5740192.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Issue with camel in Camel 2.12.0

Posted by deepak_a <an...@gmail.com>.
Hi,

I have tried
<simple>${body}</simple>
and
<simple>${in.body}</simple>

Still getting the same exception.
Looks like Camel is assuming that it to be a property 'key' being passed
into the routes.xml.

regards
D



--
View this message in context: http://camel.465427.n5.nabble.com/Issue-with-camel-el-in-Camel-2-12-0-tp5740188p5740191.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Issue with camel in Camel 2.12.0

Posted by Hilderich <hi...@yahoo.de>.
Hello!

Why don't you use

<simple>${body}</simple>

cheers
Hilderich



--
View this message in context: http://camel.465427.n5.nabble.com/Issue-with-camel-el-in-Camel-2-12-0-tp5740188p5740190.html
Sent from the Camel - Users mailing list archive at Nabble.com.