DEV Community

Andy Brunner
Andy Brunner

Posted on

UnsupportedDataTypeException: Migrating from javax.mail to jakarta.mail

While migrating a simple SMTP mailer class from javax.mail to the current jakarta.mail, I ended up with the error

UnsupportedDataTypeException: no object DCH for MIME type ...

In various forums, some people suggested to write a custom DataHandler to support the missing MIME types in the newer Jakarta mail implementations.

Fortunately, the Java code does not need to be changed (despite the import changes).

After countless number of hours searching the Internet, I finally found the correct jar files to be used during runtime:

  • angus-activation-2.0.2.jar
  • angus-mail-2.0.3.jar
  • jakarta.activation-api-2.1.3.jar
  • jakarta.mail-api-2.1.3.jar

Hope this helps someone else.

Top comments (0)