-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Sending email from ForkJoinPool.commonPool() (CompletableFuture) thread causes error #30479
Comments
Thanks for the report and the sample. I've been able to reproduce the This is the full stack trace when the error occurs:
Spring Boot auto-configures a I thought this might be a case of thread safety when the |
It could be problem with class loader of |
Yes, it seems it is the case. Adding Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader()); before mail sending leads to P.S.: Now I see tons of |
Another news: I don't know why, but after changing dependency to |
It is because And the error |
Is there a fix or a workaround that someone found for this issue? We are facing the same. |
@dipsk2, this one works for me: dependencies {
implementation("org.springframework.boot:spring-boot-starter-mail") {
exclude("org.eclipse.angus", "jakarta.mail")
implementation("com.sun.mail:jakarta.mail:2.0.1")
}
} I think a latest version will work too. |
Closing this issue as this is indeed independent of Spring Framework as explained in this comment. |
JakartaMail PR 701 should fix this issue: |
I've met an error trying to send an email from
ForkJoinPool
common pool (CompletableFuture.runAsync()
,ForkJoinPool.commonPool().execute()
, ...).The error I can reproduce is
Provider for jakarta.activation.spi.MailcapRegistryProvider cannot be found
but I also met aNot provider of jakarta.mail.util.StreamProvider was found
.bootBuildImage
). Running an app directly from IDE cause no error.Executors.newFixedThreadPool(8)
).I've made reference project freshly created by Spring initializr: https://github.com/turboezh/mail-test.
Spring Boot version is 3.0.6.
The text was updated successfully, but these errors were encountered: