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

839 views
Skip to first unread message

wm

unread,
Nov 15, 2015, 5:07:49 PM11/15/15
to Lift

When sending "recover password" email, the email will work for the 1st 2 times. Then I start to get this exception from the 3rd time.

I wonder if it's

-- javax mail problem?
-- build problem?
-- liftweb problem? something related to thread / class-loader?

why it work for 2 time after reboot, and then stop working?

  val scalaVersion = "2.9.1"
  val liftVersion = "2.5"

    "javax.mail" % "javax.mail-api" % "1.5.4",


==========================================================================================
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/alternative; 
boundary="----=_Part_10_2116398195.1447624947482"
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:896)
at javax.activation.DataHandler.writeTo(DataHandler.java:317)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1403)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1745)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1099)
at javax.mail.Transport.send0(Transport.java:189)
at javax.mail.Transport.send(Transport.java:118)
at net.liftweb.util.Mailer$$anon$4$$anonfun$$init$$4.apply(Mailer.scala:204)
at net.liftweb.util.Mailer$$anon$4$$anonfun$$init$$4.apply(Mailer.scala:204)
at net.liftweb.util.Mailer$class.performTransportSend(Mailer.scala:183)
at net.liftweb.util.Mailer$.performTransportSend(Mailer.scala:31)
at net.liftweb.util.Mailer$class.msgSendImpl(Mailer.scala:257)
at net.liftweb.util.Mailer$.msgSendImpl(Mailer.scala:31)
at net.liftweb.util.Mailer$MsgSender$$anonfun$messageHandler$1.apply(Mailer.scala:167)
at net.liftweb.util.Mailer$MsgSender$$anonfun$messageHandler$1.apply(Mailer.scala:164)
at net.liftweb.actor.SpecializedLiftActor$class.execTranslate(LiftActor.scala:320)
at net.liftweb.util.Mailer$MsgSender.execTranslate(Mailer.scala:163)
at net.liftweb.actor.SpecializedLiftActor$class.net$liftweb$actor$SpecializedLiftActor$$proc2(LiftActor.scala:288)
at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply$mcV$sp(LiftActor.scala:210)
at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply(LiftActor.scala:210)
at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply(LiftActor.scala:210)
at net.liftweb.actor.SpecializedLiftActor$class.around(LiftActor.scala:224)
at net.liftweb.util.Mailer$MsgSender.around(Mailer.scala:163)
at net.liftweb.actor.SpecializedLiftActor$class.net$liftweb$actor$SpecializedLiftActor$$processMailbox(LiftActor.scala:209)
at net.liftweb.actor.SpecializedLiftActor$$anonfun$2$$anonfun$apply$mcV$sp$1.apply$mcV$sp(LiftActor.scala:173)
at net.liftweb.actor.LAScheduler$$anonfun$9$$anon$2$$anon$3.run(LiftActor.scala:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
22:02:27.653 [pool-4-thread-14] ERROR net.liftweb.util.Mailer - Couldn't send mail
javax.mail.MessagingException: IOException while sending message
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1141) ~[mail-1.4.4.jar:1.4.4]
at javax.mail.Transport.send0(Transport.java:189) ~[jetty-runner-8.1.10.v20130312.jar:8.1.10.v20130312]
at javax.mail.Transport.send(Transport.java:118) ~[jetty-runner-8.1.10.v20130312.jar:8.1.10.v20130312]
at net.liftweb.util.Mailer$$anon$4$$anonfun$$init$$4.apply(Mailer.scala:204) ~[lift-util_2.9.1-2.5.jar:2.5]
at net.liftweb.util.Mailer$$anon$4$$anonfun$$init$$4.apply(Mailer.scala:204) ~[lift-util_2.9.1-2.5.jar:2.5]
at net.liftweb.util.Mailer$class.performTransportSend(Mailer.scala:183) ~[lift-util_2.9.1-2.5.jar:2.5]
at net.liftweb.util.Mailer$.performTransportSend(Mailer.scala:31) ~[lift-util_2.9.1-2.5.jar:2.5]
at net.liftweb.util.Mailer$class.msgSendImpl(Mailer.scala:257) ~[lift-util_2.9.1-2.5.jar:2.5]
at net.liftweb.util.Mailer$.msgSendImpl(Mailer.scala:31) ~[lift-util_2.9.1-2.5.jar:2.5]
at net.liftweb.util.Mailer$MsgSender$$anonfun$messageHandler$1.apply(Mailer.scala:167) [lift-util_2.9.1-2.5.jar:2.5]
at net.liftweb.util.Mailer$MsgSender$$anonfun$messageHandler$1.apply(Mailer.scala:164) [lift-util_2.9.1-2.5.jar:2.5]
at net.liftweb.actor.SpecializedLiftActor$class.execTranslate(LiftActor.scala:320) [lift-actor_2.9.1-2.5.jar:2.5]
at net.liftweb.util.Mailer$MsgSender.execTranslate(Mailer.scala:163) [lift-util_2.9.1-2.5.jar:2.5]
at net.liftweb.actor.SpecializedLiftActor$class.net$liftweb$actor$SpecializedLiftActor$$proc2(LiftActor.scala:288) [lift-actor_2.9.1-2.5.jar:2.5]
at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply$mcV$sp(LiftActor.scala:210) [lift-actor_2.9.1-2.5.jar:2.5]
at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply(LiftActor.scala:210) [lift-actor_2.9.1-2.5.jar:2.5]
at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply(LiftActor.scala:210) [lift-actor_2.9.1-2.5.jar:2.5]
at net.liftweb.actor.SpecializedLiftActor$class.around(LiftActor.scala:224) [lift-actor_2.9.1-2.5.jar:2.5]
at net.liftweb.util.Mailer$MsgSender.around(Mailer.scala:163) [lift-util_2.9.1-2.5.jar:2.5]
at net.liftweb.actor.SpecializedLiftActor$class.net$liftweb$actor$SpecializedLiftActor$$processMailbox(LiftActor.scala:209) [lift-actor_2.9.1-2.5.jar:2.5]
at net.liftweb.actor.SpecializedLiftActor$$anonfun$2$$anonfun$apply$mcV$sp$1.apply$mcV$sp(LiftActor.scala:173) [lift-actor_2.9.1-2.5.jar:2.5]
at net.liftweb.actor.LAScheduler$$anonfun$9$$anon$2$$anon$3.run(LiftActor.scala:64) [lift-actor_2.9.1-2.5.jar:2.5]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/alternative; 
boundary="----=_Part_10_2116398195.1447624947482"
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:896) ~[na:1.8.0_60]
at javax.activation.DataHandler.writeTo(DataHandler.java:317) ~[na:1.8.0_60]
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1403) ~[jetty-runner-8.1.10.v20130312.jar:8.1.10.v20130312]
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1745) ~[jetty-runner-8.1.10.v20130312.jar:8.1.10.v20130312]
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1099) ~[mail-1.4.4.jar:1.4.4]
... 24 common frames omitted

Antonio Salazar Cardozo

unread,
Nov 16, 2015, 4:56:24 PM11/16/15
to Lift
What kind of email are you sending? Could you show us the code that actually
constructs the email that's being sent?
Thanks,
Antonio

wm

unread,
Nov 16, 2015, 8:14:37 PM11/16/15
to Lift
I just click http://arqiv.org/user_mgt/lost_password

and input the email address. That's all. I didn't change any code.

The only thing I put in Boot.boot is:

    System.setProperty("mail.debug", "true");
    System.setProperty("mail.debug.auth", "true");

the help debug.

The thing puzzles me is that sometime it works, then it stop.

I tried external mail server as well as local installed Postfix, the result is the same.

the first one or two times, it works, then it stop working. showing error:

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

Brett Grace

unread,
Nov 16, 2015, 9:15:52 PM11/16/15
to Lift
What have you tried so far? A Google search for this particular error returns lots of hits with actionable suggestions.

wm

unread,
Nov 16, 2015, 11:36:12 PM11/16/15
to Lift
Tried many things I can find: e.g.

========================================
in Boot.boot, put this:

    var mc = CommandMap.getDefaultCommandMap().asInstanceOf[MailcapCommandMap];
    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);

    Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );

    etc.
========================================

As I said, even without these,  what puzzles me is that for the first one or two times, it works, then it stop working. showing error.

Since this is a common error as show by Google search, there maybe some subtle Javax mail bugs not really in liftweb.
BUT I want a work-around for now.
Here is my question:

-- How can I dump the email message generated by Liftweb to a txt file?

I want to use a python program to send it. This Java bug drive me crazy.

Brett Grace

unread,
Nov 17, 2015, 1:16:49 PM11/17/15
to Lift
The Lift Cookbook has a recipe for logging your email: http://chimera.labs.oreilly.com/books/1234000000030/ch09.html

As for the rest, I think your guesses (build problem [library incompatibility] or class loader) sound reasonable. I can't say I've encountered it, though. If you can create a repo with a Lift app that wakes up, tries to send email, and then trips this bug, somebody will probably take up the challenge of figuring out why.
Reply all
Reply to author
Forward
0 new messages