activation.jar in two separate Tomcat webapps causes javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;

StackOverflow https://stackoverflow.com/questions/23083923

  •  04-07-2023
  •  | 
  •  

Question

I have two Java web applications in Tomcat 7.

  • tomcat/webapps/app1
  • tomcat/webapps/app2

App1 sends an email with attachments. No problem.

Deploy App2 and suddenly, App1 cannot send emails with attachments any more and gives the following exception:

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

Remove App2 again, and App1 is able to send emails with attachments.

How can one application affect another like that?

Was it helpful?

Solution

I upgraded to JavaMail 1.4.7 in App 1 which didnt fix the issue as suggested on other posts. I did programmatically set the MailcapCommandMap config as per below which worked. Note this was taken from another post.

MailcapCommandMap mailcapCommandMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    mailcapCommandMap.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
    mailcapCommandMap.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
    mailcapCommandMap.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
    mailcapCommandMap.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
    mailcapCommandMap.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
    CommandMap.setDefaultCommandMap(mailcapCommandMap);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top