In the development of the machine, the mail is not a problem, and generally should not have any problems, Commons_email and Javax.mail collocation for a long time, low-level problems should almost no, but upload to the server, no
Javax.activation.UnsupportedDataTypeException:no object DCH for MIME type multipart/mixed
Before usually is htmlmail, this time has the attachment, therefore is multipartmail, the result problem is out here, removes the attachment not to be possible.
The reason can also estimate a probably, plus exception information, must be the problem of mime, and the Web application in Web-inf/web.xml did not specify application holder the same truth, But how do you specify it in Multipartmail?
Put the dog
Find out to set mailcap in the local, invalid, say, local also did not set, should not be this problem.
Check again, generally think is the question of javax.activation and jdk6, but I have the same version on both sides, not
But where is this thing specified, check jar bag meta-inf, found activation have mailcap.default, Mail.jar have mailcap, and local no activation also run normal, should be packing problem.
See Build.xml, found in order to avoid the previous unknown problem, in Unjar all jars and packaging, removed Meta-inf, remember to avoid index.list conflict problems, but also the previous Ant bug
This should be the problem, repackage, OK
In addition, it can also be mail.send before, manually add such a paragraph
Mailcapcommandmap MC = (MAILCAPCOMMANDMAP) commandmap
. Getdefaultcommandmap ();
Mc
. Addmailcap ("text/html;; X-java-content-handler=com.sun.mail.handlers.text_html ");
Mc
. Addmailcap ("text/xml;; X-java-content-handler=com.sun.mail.handlers.text_xml ");
Mc
. Addmailcap ("text/plain;; X-java-content-handler=com.sun.mail.handlers.text_plain ");
Mc
. Addmailcap ("multipart/*;; X-java-content-handler=com.sun.mail.handlers.multipart_mixed ");
Mc
. Addmailcap ("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822 ");
Commandmap.setdefaultcommandmap (MC);
Article Source: http://yyri.blog.sohu.com/134367998.html