I am new to working with jakarta.mail. I am getting the following error when creation the Session object for jakarta.mail.
java.lang.IllegalStateException: Not provider of jakarta.mail.util.StreamProvider was found
The error is thrown by the FactoryFinder class find method when called by the StreamProvider class provider method, seems there are no available service providers?? Not sure what this means, new to writing email notification code.
authenticator is null, port is 25.
It appears that you are only linking to the jakarta.mail-api library, which only contains the API and not the actual implementation. Try something like this in your Maven POM file.
Note the inclusion of the org.eclipse.angus:jakarta.mail dependency.
<!-- Jakarta email support -->
<!-- https://jakarta.ee/specifications/mail/ -->
<!-- https://github.com/jakartaee/mail-api -->
<dependency>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<!-- https://github.com/eclipse-ee4j/angus-mail -->
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>jakarta.mail</artifactId>
<version>1.0.0</version>
</dependency>
Angus Mail 1.0 seems to be compatible with Jakarta Mail 2.1.x but does not work with Java module system.
If you want to step forward (use jakarta.mail instead of javax.mail and Java module system) consider using Angus Mail 2.x instead of 1.0:
<!-- https://mvnrepository.com/artifact/jakarta.mail/jakarta.mail-api -->
<dependency>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
<version>2.1.4</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.angus/angus-mail -->
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-mail</artifactId>
<version>2.0.4</version>
<scope>runtime</scope>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With