Because you use seda to hand off processing the mail. Use direct
instead, or use wait=always for seda to ensure the mail has been
processed, when you at the end is marking the mail as deleted etc.
That work must happen on same thread and after you have processed the
mail.


On Tue, Mar 18, 2014 at 4:08 PM, contactreji <[email protected]> wrote:
> Hi
>
> I have a route as follows
>
> *       <route>
>
>                                 <from
>
> uri="imaps://[email protected]&amp;password=mypassword&amp;delete=false&amp;unseen=true&amp;consumer.delay=60000&amp;mapMailMessage=true&amp;delete=true"
> />
>
>                                 <to uri="seda:emails" />
>
>                         </route>*
>
>
> On execution, I am getting following runtime error. Can you tell me why
> there is a NULL pointor exception. My email does contain content for the
> Email Body though.
>
>
> 2014-03-18 20:28:58,677 [ing.Main.main()] INFO  SpringCamelContext
> - Total 1 routes, of which 1 is started.
> 2014-03-18 20:28:58,678 [ing.Main.main()] INFO  SpringCamelContext
> - Apache Camel 2.10.0.fuse-71-047 (CamelContext: camel-1) started in 0.852
> seconds
> 2014-03-18 20:31:11,398 [/imap.gmail.com] WARN  MailConsumer
> - Caused by: [org.apache.camel.RuntimeCamelException - Failed to extract
> body due to: null. Exchange: Exchange[MailMessage: messageNumber=[1],
> from=[Sample Sender <[email protected]>], to=[[email protected]],
> subject=[test], sentDate=[18 Mar, 2014 8:29:42 PM], receivedDate=[18 Mar,
> 2014 8:29:44 PM]]. Message: com.sun.mail.imap.IMAPMessage@121cbd6]
> org.apache.camel.RuntimeCamelException: Failed to extract body due to: null.
> Exchange: Exchange[MailMessage: messageNumber=[1], from=[Frenchi Elizabeth
> <[email protected]>], to=[[email protected]], subject=[test],
> sentDate=[18 Mar, 2014 8:29:42 PM], receivedDate=[18 Mar, 2014 8:29:44 PM]].
> Message: com.sun.mail.imap.IMAPMessage@121cbd6
>         at
> org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:269)
>         at
> org.apache.camel.component.mail.MailMessage.createBody(MailMessage.java:96)
>         at 
> org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:41)
>         at 
> org.apache.camel.impl.MessageSupport.copyFrom(MessageSupport.java:135)
>         at
> org.apache.camel.component.mail.MailMessage.copyFrom(MailMessage.java:130)
>         at org.apache.camel.impl.MessageSupport.copy(MessageSupport.java:124)
>         at 
> org.apache.camel.component.mail.MailMessage.copy(MailMessage.java:56)
>         at 
> org.apache.camel.component.mail.MailMessage.copy(MailMessage.java:33)
>         at
> org.apache.camel.impl.DefaultUnitOfWork.<init>(DefaultUnitOfWork.java:91)
>         at
> org.apache.camel.impl.DefaultUnitOfWork.<init>(DefaultUnitOfWork.java:71)
>         at
> org.apache.camel.processor.UnitOfWorkProcessor.createUnitOfWork(UnitOfWorkProcessor.java:190)
>         at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)
>         at
> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)
>         at
> org.apache.camel.component.mail.MailConsumer.processExchange(MailConsumer.java:238)
>         at
> org.apache.camel.component.mail.MailConsumer.processBatch(MailConsumer.java:189)
>         at
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Polling-Email-Component-Runtime-Error-tp5749047.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

Reply via email to