Creating instance of org.apache.commons.mail.MultiPartEmail the following problem occures:
java.lang.NoClassDefFoundError: javax/mail/Authenticator
at mypackage.MyClass.sendMail(MyClass.java:123)
...
Caused by: java.lang.ClassNotFoundException: javax.mail.Authenticator from [Module "org.apache.commons:main" from local module loader @5a4041cc (finder: local module finder @15b3e5b (roots: C:\wildfly-10.1.0.Final\modules,C:\wildfly-10.1.0.Final\modules\system\layers\base))]
pom.xml contains:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.3.3</version>
<scope>provided</scope>
</dependency>
wildfly-10.1.0.Final\modules\org\apache\commons\main\commons-email-1.3.3.jar\org\apache\commons\mail\MultiPartEmail.class exists and jboss-deployment-structure.xml contains:
<module name="org.apache.commons" />
<system export="true">
<paths>
<path name="javax/api"/>
<path name="javax/activation/api"/>
<path name="javax/mail/api"/>
</paths>
</system>
Remove the <scope>provided</scope>
.