October 22, 2024
Chicago 12, Melborne City, USA
java

Jakarta mail – No provider of jakarta.mail.util.StreamProvider was found


Using following dependency in my project to send email

  'jakarta.activation:jakarta.activation-api:2.1.3',
  'org.eclipse.angus:angus-mail:2.0.3',

I have tested the email generation in local using my gmail account as host email and it works fine.

but the application throws exception. Application is java web application and deployed in tomcat. verified the lib folder and I do see the both Jars.

exception trace:
58:Exception in thread "main" java.lang.IllegalStateException: No provider of jakarta.mail.util.StreamProvider was found
59: at jakarta.mail.util.FactoryFinder.find(FactoryFinder.java:61)
60: at jakarta.mail.util.StreamProvider.provider(StreamProvider.java:199)
61: at jakarta.mail.Session.<init>(Session.java:257)
62: at jakarta.mail.Session.getDefaultInstance(Session.java:383)

Gone throw few previous post and tried the following but nothing helped

  1. Created a File Named jakarta.mail.util.StreamProvider under the META-INF/services/ directory.
    Add the Following Content to the jakarta.mail.util.StreamProvider file: org.eclipse.angus.mail.util.MailStreamProvider
  2. Added following java opts
    "-Djakarta.mail.util.StreamProvider=org.eclipse.angus.mail.util.MailStreamProvider"

Thanks for your help in advance. any direction would be appreciated.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video