Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downgrade jakarta.mail to 1.6.7 to fix email features #1113

Merged
merged 1 commit into from
Jan 17, 2022
Merged

Conversation

gaetanmaisse
Copy link
Contributor

@gaetanmaisse gaetanmaisse commented Jan 17, 2022

Issue

Email service isn't working anymore, doing any action resulting in an email will lead to the following error:

Caused by: org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.NoSuchProviderException: smtp. Failed messages: javax.mail.NoSuchProviderException: smtp
	at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:448)
	at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:361)
	at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:356)
	at io.gravitee.rest.api.service.impl.EmailServiceImpl.sendEmailNotification(EmailServiceImpl.java:157)
	... 18 common frames omitted
Caused by: javax.mail.NoSuchProviderException: smtp
	at javax.mail.Session.getService(Session.java:874)
	at javax.mail.Session.getTransport(Session.java:804)
	at javax.mail.Session.getTransport(Session.java:745)
	at javax.mail.Session.getTransport(Session.java:725)
	at org.springframework.mail.javamail.JavaMailSenderImpl.getTransport(JavaMailSenderImpl.java:538)
	at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:517)
	at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:437)
	... 21 common frames omitted

Description

JakartaMail 2.x switched to the new jakarta.mail namespace.
So libraries using earlier versions of JakartaMail/JavaMail will not work with it as they need the javax.mail namespace.

Spring 5.x is importing stuff from javax.mail namespace and so cannot be used with JakartaMail 2.x for now.

According to Support for Jakarta EE 9 (annotations and interfaces in jakarta.* namespace), Spring will switch to using the jakarta.* namespace in Spring Framework 6 / Spring Boot 3. For details see: spring-projects/spring-framework#25354


📚  View the storybook of this branch here

🚀 CI was able to deploy the build of this PR, so you can now try it directly here
Notes: The deployed app is linked to the management API of the Element Zero team's environment.

JakartaMail 2.x switched to the new `jakarta.mail` namespace.
So libraries using earlier versions of JakartaMail/JavaMail will not work with it as they need the `javax.mail` namespace.

Spring 5.x is importing stuff from `javax.mail` namespace and so cannot be used with JakartaMail 2.x for now.

According to Support for Jakarta EE 9 (annotations and interfaces in jakarta.* namespace), Spring will switch to using the jakarta.* namespace in Spring Framework 6 / Spring Boot 3. For details see: spring-projects/spring-framework#25354
@gaetanmaisse gaetanmaisse requested a review from a team as a code owner January 17, 2022 14:13
@gaetanmaisse gaetanmaisse merged commit 4a89ac7 into master Jan 17, 2022
@gaetanmaisse gaetanmaisse deleted the fix-email branch January 17, 2022 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants