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
  •  | 
  •  

문제

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?

도움이 되었습니까?

해결책

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);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top