Sunday, September 29, 2013

Fuse ESB : Email Attachement Issue

I faced a very annoying issue when I tried to send an email with attachments using Fuse ESB. I created a simple project in Fuse IDE which sent a mail with attachments and it was working fine as a stand alone application but when the bundle was deployed in Fuse it was not sending the mail when there are attachments. There was no exception in logs, but then it was found that there is actually an exception and it was getting set to the exchange.

javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;

Many have come across this issue when dealing with javamail in other containers and for most of them it was because javamail jar was not found by the container.

Some solutions that have worked were found in this.
http://blog.hpxn.net/2009/12/02/tomcat-java-6-and-javamail-cant-load-dch/

But unfortunately it didn't work for me. 

javax.activation package exposed by the jre was not working. Removing it and adding an OSGI friendly version of this package created by Servicemix resolved the issue.

Solution
  1. Comment out the javax.activation export from jre.properties
  2. Install following bundle instead. install mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/2.2.0