Thank you it works the way you suggest. By the way I can use the code below to 
get customer pojo. 

Customer c = exchng.getIn().getBody(Customer.class);

But when I use it in the SimpleBuilder i should use with array notation ? I did 
not get the reason well.

Thank you anyway.

-----Original Message-----
From: Joakim Bjørnstad [mailto:joak...@gmail.com] 
Sent: Thursday, November 12, 2015 3:10 PM
To: users@camel.apache.org
Subject: Re: SimpleBuilder usage in camel

Hello,

In your example, ${body} is still of type Object[]. So it seems the 
SimpleBuilder evaluates it to null since getFirstName() is not a method on the 
Object[] in body.

Try:

System.out.println(SimpleBuilder.simple("Hello
${body[0].getFirstName()}").evaluate(exchng, String.class));

On Thu, Nov 12, 2015 at 1:11 PM, Kasim Sert (Ibtech-Software
Infrastructure) <kasim.s...@ibtech.com.tr> wrote:
> Hi,
>
> I have following processor, when I run it from my route I get the following 
> error.  I know exchange body is not null and you can see it in logs below. 
> What is wrong with my usage of SimpleBuilder here ?
>
> public class UpdateCustomerProcessor implements Processor {
>     public static final Logger log = 
> LoggerFactory.getLogger(UpdateCustomerProcessor.class);
>
>     public void process(Exchange exchng) throws Exception {
>         Customer c = (Customer) exchng.getIn().getBody(Object[].class)[0];
>         System.out.println("Updating customer " + c.getFirstName() + " " + 
> c.getLastName());
>         System.out.println(SimpleBuilder.simple("Hello 
> ${body.getFirstName()}").evaluate(exchng, String.class));
>         exchng.getOut().setBody(new Object[] {});
>     }
>
> }
>
> Updating customer kasim sert
> org.apache.cxf.interceptor.Fault: Failed to invoke method: 
> .getFirstName() on null due to: 
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed 
> to invoke method: getFirstName() on null
>
>
>
> [Facebook]<http://www.facebook.com/Finansbank>  [Twitter] 
> <http://twitter.com/finansbank>
>
> [https://www.finansbank.com.tr/Disclaimer/BannerImages.aspx?date=12.11
> .201514:1100]<https://www.finansbank.com.tr/Disclaimer/Bannerlink.aspx
> ?date=12.11.201514:1100>
>
>
> Bu e-posta'n?n i?erdi?i bilgiler (ekleri dahil olmak ?zere) gizlidir. 
> Onay?m?z olmaks?z?n ???nc? ki?ilere a?iklanamaz. Bu mesaj?n g?nderilmek 
> istendi?i ki?i de?ilseniz, l?tfen mesaj? sisteminizden derhal siliniz. IBTech 
> A.?. bu mesaj?n i?erdi?i bilgilerin do?rulu?u veya eksiksiz oldu?u konusunda 
> bir garanti vermemektedir. Bu nedenle bilgilerin ne ?ekilde olursa olsun 
> i?eri?inden, iletilmesinden, al?nmas?ndan, saklanmas?ndan sorumlu de?ildir. 
> Bu mesaj?n i?eri?i yazar?na ait olup, IBTech A.?.'nin g?r??lerini 
> i?ermeyebilir.
>
> The information contained in this e-mail (including any attachments)is 
> confidential. It must not be disclosed to any person without our authority. 
> If you are not the intended recipient, please delete it from your system 
> immediately. IBTech A.S. makes no warranty as to the accuracy or completeness 
> of any information contained in this message and hereby excludes any 
> liability of any kind for the information contained therein or for the 
> information transmission, reception, storage or use of such in any way 
> whatsoever. Any opinions expressed in this message are those of the author 
> and may not necessarily reflect the opinions of IBTech A.S.



--
Kind regards
Joakim Bjørnstad


Bu e-posta'nin içerdigi bilgiler (ekleri dahil olmak 
üzere) gizlidir. Onayimiz olmaksizin üçüncü kisilere açiklanamaz. Bu mesajin 
gönderilmek istendigi kisi degilseniz, lütfen mesaji sisteminizden derhal 
siliniz. IBTech A.S. bu mesajin içerdigi bilgilerin dogrulugu veya eksiksiz 
oldugu konusunda bir garanti vermemektedir. Bu nedenle bilgilerin ne sekilde 
olursa olsun içeriginden, iletilmesinden, alinmasindan, saklanmasindan sorumlu 
degildir. Bu mesajin içerigi yazarina ait olup, IBTech A.S.'nin görüslerini 
içermeyebilir.

The information contained in this e-mail (including any 
attachments)is confidential. It must not be disclosed to any person without our 
authority. If you are not the intended recipient, please delete it from your 
system immediately. IBTech A.S. makes no warranty as to the accuracy or 
completeness of any information contained in this message and hereby excludes 
any liability of any kind for the information contained therein or for the 
information transmission, reception, storage or use of such in any way 
whatsoever. Any opinions expressed in this message are those of the author and 
may not necessarily reflect the opinions of IBTech 
A.S.

Reply via email to