You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by st...@zv-extern.fraunhofer.de on 2014/03/27 16:54:12 UTC

Mail-Component: Error populating the initial mail message attachments

Hello,

I'm using camel 2.11.1.

I try to read emails from an exchange-server via imap(s):
      from(
      "imaps://{{email.server}}?username={{email.username}}&password=RAW({{email.password}})"
         + "&delete=false&unseen=true&consumer.delay=600000&folderName={{email.folder}}"
         + "&debugMode=true&mapMailMessage=false"
         + "&fetchSize=1&contentType=text/html")
 
If - for example - the mail is signed, I get the following error:
org.apache.camel.RuntimeCamelException: Error populating the initial mail message attachments
        at org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:124)
        at org.apache.camel.impl.DefaultMessage.createAttachments(DefaultMessage.java:209)
        at org.apache.camel.impl.DefaultMessage.getAttachments(DefaultMessage.java:274)
        at org.apache.camel.component.mail.MailMessage.copy(MailMessage.java:62)
        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:72)
        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:255)
        at org.apache.camel.component.mail.MailConsumer.processBatch(MailConsumer.java:199)
        at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:118)
        at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:142)
        at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:722)
Caused by: javax.mail.MessagingException: Unable to load BODYSTRUCTURE
        at com.sun.mail.imap.IMAPMessage.loadBODYSTRUCTURE(IMAPMessage.java:1319)
        at com.sun.mail.imap.IMAPMessage.getDataHandler(IMAPMessage.java:623)
        at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1420)
        at org.apache.camel.component.mail.MailBinding.extractAttachmentsFromMail(MailBinding.java:291)
        at org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:121)
        ... 29 more

The bodystructure of the message is (strings lightly edited):
A1360 FETCH 1480 (BODYSTRUCTURE)
* 1480 FETCH (BODYSTRUCTURE ((("text" "plain" ("charset" "iso-8859-1") NIL NIL "quoted-printable" 4137 132 NIL NIL NIL NIL)("text" "html" ("charset" "iso-8859-1") NIL NIL "quoted-printable" 13030 277 NIL NIL NIL NIL) "alternative" ("boundary" "_000_241616E998699141B69B9BF77D41B532039D56447310ZVSRVEX02ze_") NIL NIL)("message" "rfc822" NIL NIL NIL "7BIT" 587920 ("Fri, 20 Mar 2009 11:24:14 +0100" " Tagung vom 22.-24.12.09" (("Frau Jedermann" NIL "frau.jedermann" "my.comany.de")) NIL NIL (("Verwaltungsleiter " NIL "verwaltungsleiter " "comany.de") ("hauptabteilungsleiter-verteiler" NIL "hauptabteilungsleiter-verteiler" "my.comany.de") ("abteilungsleiter-verteiler" NIL "abteilungsleiter-verteiler" "my.comany.de")) NIL NIL NIL "<9D...@EX01.zentrale.zv.fhg.de>") ("multipart" "signed" ("protocol" "application/x-pkcs7-signature" "micalg" "SHA1" "boundary" "----=_NextPart_000_009C_01C9B782.AC445280") NIL NIL "7BIT" -1 NIL NIL NIL NIL) 7623 NIL NIL NIL NIL) "mixed" ("boundary" "_004_241616E998699141B69B9BF77D41B532039D56447310ZVSRVEX02ze_") NIL "de-DE"))
A1360 OK FETCH completed.

I think, the problem is the signature of the attachment (see https://java.net/projects/javamail/pages/Exchange).

How can I deal with this error? 
For example by asking the imap-component to store the attachments unchanged (like the option mapMailMessage=false does with the mail-body).

Kind regards,
Stefan Hof



Re: Mail-Component: Error populating the initial mail message attachments

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah that mapMailMessage=false had a bug with UoW which is fixed in
next Camel releases.
There is a JIRA ticket about that.

On Thu, Mar 27, 2014 at 4:54 PM,  <st...@zv-extern.fraunhofer.de> wrote:
> Hello,
>
> I'm using camel 2.11.1.
>
> I try to read emails from an exchange-server via imap(s):
>       from(
>       "imaps://{{email.server}}?username={{email.username}}&password=RAW({{email.password}})"
>          + "&delete=false&unseen=true&consumer.delay=600000&folderName={{email.folder}}"
>          + "&debugMode=true&mapMailMessage=false"
>          + "&fetchSize=1&contentType=text/html")
>
> If - for example - the mail is signed, I get the following error:
> org.apache.camel.RuntimeCamelException: Error populating the initial mail message attachments
>         at org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:124)
>         at org.apache.camel.impl.DefaultMessage.createAttachments(DefaultMessage.java:209)
>         at org.apache.camel.impl.DefaultMessage.getAttachments(DefaultMessage.java:274)
>         at org.apache.camel.component.mail.MailMessage.copy(MailMessage.java:62)
>         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:72)
>         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:255)
>         at org.apache.camel.component.mail.MailConsumer.processBatch(MailConsumer.java:199)
>         at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:118)
>         at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:142)
>         at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>         at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:722)
> Caused by: javax.mail.MessagingException: Unable to load BODYSTRUCTURE
>         at com.sun.mail.imap.IMAPMessage.loadBODYSTRUCTURE(IMAPMessage.java:1319)
>         at com.sun.mail.imap.IMAPMessage.getDataHandler(IMAPMessage.java:623)
>         at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1420)
>         at org.apache.camel.component.mail.MailBinding.extractAttachmentsFromMail(MailBinding.java:291)
>         at org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:121)
>         ... 29 more
>
> The bodystructure of the message is (strings lightly edited):
> A1360 FETCH 1480 (BODYSTRUCTURE)
> * 1480 FETCH (BODYSTRUCTURE ((("text" "plain" ("charset" "iso-8859-1") NIL NIL "quoted-printable" 4137 132 NIL NIL NIL NIL)("text" "html" ("charset" "iso-8859-1") NIL NIL "quoted-printable" 13030 277 NIL NIL NIL NIL) "alternative" ("boundary" "_000_241616E998699141B69B9BF77D41B532039D56447310ZVSRVEX02ze_") NIL NIL)("message" "rfc822" NIL NIL NIL "7BIT" 587920 ("Fri, 20 Mar 2009 11:24:14 +0100" " Tagung vom 22.-24.12.09" (("Frau Jedermann" NIL "frau.jedermann" "my.comany.de")) NIL NIL (("Verwaltungsleiter " NIL "verwaltungsleiter " "comany.de") ("hauptabteilungsleiter-verteiler" NIL "hauptabteilungsleiter-verteiler" "my.comany.de") ("abteilungsleiter-verteiler" NIL "abteilungsleiter-verteiler" "my.comany.de")) NIL NIL NIL "<9D...@EX01.zentrale.zv.fhg.de>") ("multipart" "signed" ("protocol" "application/x-pkcs7-signature" "micalg" "SHA1" "boundary" "----=_NextPart_000_009C_01C9B782.AC445280") NIL NIL "7BIT" -1 NIL NIL NIL NIL) 7623 NIL NIL NIL NIL) "mixed" ("boundary" "_004_241616E998699141B69B9BF77D41B532039D56447310ZVSRVEX02ze_") NIL "de-DE"))
> A1360 OK FETCH completed.
>
> I think, the problem is the signature of the attachment (see https://java.net/projects/javamail/pages/Exchange).
>
> How can I deal with this error?
> For example by asking the imap-component to store the attachments unchanged (like the option mapMailMessage=false does with the mail-body).
>
> Kind regards,
> Stefan Hof
>
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
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