UnsupportedDataTypeException: Migrating from javax.mail to jakarta.mail
Andy Brunner

Andy Brunner @andybrunner

About: IT Consultant, Software Developer and System Administrator. Since several years in the process of getting retired. Mastodon: https://swiss.social/@andybrunner

Location:
Zurich
Joined:
Jul 4, 2024

UnsupportedDataTypeException: Migrating from javax.mail to jakarta.mail

Publish Date: Sep 2 '24
2 0

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.

Comments 0 total

    Add comment