Hi
I think you need to remove
<transform>
<simple>${body[0]}</simple>
</transform>
On Sat, Feb 22, 2014 at 9:57 AM, bhagavan <[email protected]> wrote:
> Hi, I'm unable to store CSV file into Data base with Camel bindy
>
> <camel:route id="bindy-csv-unmarshalling-example" autoStartup="true">
> <camel:from
> uri="file:inbox/csv?noop=true&delay=10" />
> <camel:log message="CSV to DB Using Bindy"
> loggingLevel="WARN"/>
> <camel:split streaming="true">
> <camel:tokenize token="\n" group="1" />
> <camel:unmarshal ref="bindyDataformat" >
> <camel:bindy type="Csv"
> locale="en-us"
> classType="org.apache.camel.example.fixedlength.Employee"/>
> </camel:unmarshal>
> <camel:log message="OUTPUT FOR CSV Record ::: ${body}"
> loggingLevel="WARN" />
> <transform>
> <simple>${body[0]}</simple>
> </transform>
> <camel:to uri="sql:insert into player (id, name, city)
> values
> (:#id,:#name,:#city)?dataSourceRef=dataSource"/>
> </camel:split>
> <camel:stop/>
> </camel:route>
>
>
> I'm facing the following error
>
> [ #0 - file://inbox/fixedlength] d-length-unmarshalling-example WARN OUTPUT
> FOR CSV Record ::: Employee [Id=6, name=chand, city=tanuku]
> [ #0 - file://inbox/fixedlength] DefaultErrorHandler ERROR Failed
> delivery for . Exhausted after delivery attempt: 1 caught:
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
> invoke method: [0] on null due to: java.lang.IndexOutOfBoundsException: Key:
> 0 not found in bean: Employee [Id=6, name=chand, city=tanuku] of type:
> org.apache.camel.example.fixedlength.Employee using OGNL path [[0]]
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
> invoke method: [0] on null due to: java.lang.IndexOutOfBoundsException: Key:
> 0 not found in bean: Employee [Id=6, name=chand, city=tanuku] of type:
> org.apache.camel.example.fixedlength.Employee using OGNL path [[0]]
> at
> org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:117)
> at
> org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:132)
>
> Thanks in Adavance
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Store-CSV-file-to-Mysql-DB-using-Camel-Bindy-and-Camel-sql-got-stucked-tp5747812.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [email protected]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io