Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

javax.activation.UnsupportedDataTypeException: multipart/mixed

$
0
0
Hi,

I have some code to send an email notification:

<bean id="attacher"
class="au.edu.mq.dataswitch.adapter.invoices.AttachmentAttacher" />

<camel:route startupOrder="109" errorHandlerRef="transactionErrorHandler">

<camel:from uri="direct:rejection_notification" />

<bean ref="attacher" />

<setHeader headerName="subject">
<simple>${properties:smtp.notification.subject}</simple>
</setHeader>
<setHeader headerName="to">
<simple>${properties:smtp.notification.to}</simple>
</setHeader>
<setHeader headerName="from">
<simple>${properties:smtp.notification.from}</simple>
</setHeader>
<setHeader headerName="CC">
<simple>${properties:smtp.notification.cc}</simple>
</setHeader>
<setHeader headerName="BCC">
<simple>${properties:smtp.notification.bcc}</simple>
</setHeader>

<setBody>
<simple>${properties:smtp.notification.text}</simple>
</setBody>

<to uri="{{smtp.notification.server}}" />

</camel:route>

public class AttachmentAttacher {

private static Logger log = Logger.getLogger(AttachmentAttacher.class
.getName());

public void process(Exchange exchange) {

log.debug("damien: AttachmentAttacher starting ...");
Message in = exchange.getIn();
byte[] file = in.getBody(byte[].class);
in.addAttachment("rejection", new DataHandler(new String(file),
"text/plain"));

It works with camel-mail-2.8.2. But when I upgrade the Karaf container which
is using camel-mail-2.12.2, it failed:

10:34:20,229 | DEBUG | nation.invoices] | com.sun.mail.util.MailLogger
221 | 204 - javax.mail - 1.4.7 | damien.chen [ at ] mq.edu.au
10:34:20,230 | DEBUG | nation.invoices] | com.sun.mail.util.MailLogger
221 | 204 - javax.mail - 1.4.7 | damien.chen [ at ] mq.edu.au
10:34:20,232 | DEBUG | nation.invoices] | com.sun.mail.util.MailLogger
280 | 204 - javax.mail - 1.4.7 | IOException while sending, closing
javax.activation.UnsupportedDataTypeException: multipart/mixed;
boundary="----=_Part_5148_1013099633.1399422860146"
at javax.activation.DataHandler.writeTo(DataHandler.java:75)[:2.2.0]
at
javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1485)[56:javax.mail:1.4.5]

Do you have any idea how i can fix this?

Thanks a lot!
Damien

Viewing all articles
Browse latest Browse all 5648

Trending Articles