Hi,
I'm using WildFly 28.0.1, and I'm trying to use the jakarta.mail.api.I added these module dependencies to my module:
<module name="javax.mail.api" export="true"/>
<module name="org.eclipse.angus.mail" export="true"/>
What happens if you add neither of these module dependencies but
instead just try to use the jakarta.mail api?
Scott
but sending mail fails with:
java.lang.IllegalStateException: Not provider of jakarta.mail.util.StreamProvider was found
at jakarta.mail.api//jakarta.mail.util.FactoryFinder.find(FactoryFinder.java:64)
at jakarta.mail.api//jakarta.mail.util.StreamProvider.provider(StreamProvider.java:186)
at jakarta.mail.api//jakarta.mail.Session.<init>(Session.java:254)
at jakarta.mail.api//jakarta.mail.Session.getDefaultInstance(Session.java:381)
at deployment.main.ear.shared-session.jar//com.opsware.shared.job.WlmJobNotificationEmail.send(WlmJobNotificationEmail.java:203)
at deployment.main.ear.shared-session.jar//com.opsware.shared.job.WlmJobNotificationEmail.notify(WlmJobNotificationEmail.java:85)
at deployment.main.ear.shared-session.jar//com.opsware.shared.job.WlmJobNotification.notifyOnFailure(WlmJobNotification.java:72)
at deployment.main.ear.shared-session.jar//com.opsware.shared.job.WlmJobNotification.notifyOnAny(WlmJobNotification.java:32)
at deployment.main.ear.shared-session.jar//com.opsware.shared.job.JobQueueManager.startAndUpdateJobRuntime(JobQueueManager.java:622)
at deployment.main.ear.shared-session.jar//com.opsware.shared.job.JobQueueManager$JobDistributionThread.run(JobQueueManager.java:867)
Looked over jakarta.mail.util.FactoryFinder.find method, and was able to fix this by adding the following system property: -Djakarta.mail.util.StreamProvider=org.eclipse.angus.mail.util.MailStreamProvider
But I was under the impression that adding org.eclipse.angus.mail module dependency should be enough to load services from angus.jar/META-INF/services/
Am I doing something wrong or this is the way it's supposed to work?
Thanks.
--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/cb72aa12-9a6c-4474-8181-3af2567e8dafn%40googlegroups.com.
Using <module name="jakarta.mail.api" export="true"/> instead of the two modules mentioned above, has the exact same behavior. javax.mail.api is just a module alias for jakarta.mail.api
Is your module application deployment? Or are you manually
adding your module under wildfly/modules?
If you are deploying an application that you wish to use
jakarta.mail from, that should be handled via
https://github.com/wildfly/wildfly/blob/main/mail/src/main/java/org/jboss/as/mail/extension/MailDependenciesProcessor.java
which adds dependencies for jakarta.mail.api +
jakarta.activation.api + org.eclipse.angus.mail +
org.eclipse.angus.activation via constructor in
https://github.com/wildfly/wildfly-core/blob/main/server/src/main/java/org/jboss/as/server/deployment/module/ModuleDependency.java.
The source references can help you see the settings used by MailDependenciesProcessor.java
that you likely need to use also.
Scott
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/f6f280f5-2b06-4153-8a88-8c7756263aban%40googlegroups.com.
For a better understanding, here is my environment:
```
┌────────────────┐ ┌─────────────────────────────────┐ ┌─────────────────────────┐
│ │ depends on │ │depends on│ │
│ main.ear ├───────────────► mymodule-from-wildfly/modules ├──────────► jakarta.mail.api │
│ │ │ │ │ │
└────────────────┘ └─────────────────────────────────┘ └─────────────────────────┘
```
So,my module that depends on jakarta.mail.api is manually added under wildfly/modules, and I try to use the jakarta.mail.api from main.ear
I replicated what MailDependenciesProcessor.java does, and added the following dependencies to my module:
<module name="jakarta.mail.api" export="true" services="import"/>
<module name="jakarta.activation.api" export="true" services="import"/>
<module name="org.eclipse.angus.mail" export="true" services="import">
<imports>
<include path="META-INF"/>
</imports>
</module>
<module name="org.eclipse.angus.activation" export="true" services="import"/>
Tried to add these dependencies directly to main.ear as well, but I cannot seem to get rid of the issue. The only thing that works for me is using -Djakarta.mail.util.StreamProvider=org.eclipse.angus.mail.util.MailStreamProvider system property as initially described.
Thank you all for the help.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/eaa0cd7d-87f8-4876-8759-6306779afe60n%40googlegroups.com.