Cannot upgrade beyond 8.5.1 due to NoClassDefFoundError: org/eclipse/angus/mail/smtp/SMTPMessage
8.5.2 works, but I can't upgrade beyond that without dependency overrides. I'm running OpenJdk 19 on MacOS and GCP cloud function gen 2 with Java 17. The project has a parent mvn project with simple-java-mail and email service. The child project adds only spring-boot-starter-web 3.3.2 (latest). After the simple java mail upgrade to 8.11.2 (or just 8.6.0), I get the following:
Caused by: java.lang.NoClassDefFoundError: org/eclipse/angus/mail/smtp/SMTPMessage
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:149)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at org.simplejavamail.converter.internal.mimemessage.MimeMessageProducerHelper.<clinit>(MimeMessageProducerHelper.java:38)
dependency:tree shows:
[INFO] +- org.simplejavamail:simple-java-mail:jar:8.11.2:compile
[INFO] | +- org.simplejavamail:core-module:jar:8.11.2:compile
[INFO] | | +- jakarta.mail:jakarta.mail-api:jar:2.1.2:compile
[INFO] | | | \- jakarta.activation:jakarta.activation-api:jar:2.1.2:compile
[INFO] | | +- org.eclipse.angus:angus-mail:jar:1.1.0:runtime
[INFO] | | | \- org.eclipse.angus:angus-activation:jar:2.0.1:runtime
[INFO] | | \- com.sanctionco.jmail:jmail:jar:1.4.1:compile
[INFO] | +- com.github.bbottema:jetbrains-runtime-annotations:jar:1.0.2:compile
[INFO] | \- com.pivovarit:throwing-function:jar:1.5.1:compile
Those libraries do not include org.eclipse.angus.mail.smtp.SMTPMessage. No other "mail" in the dependency tree. My only solution that worked is to add the following to the child mvn project:
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>simple-java-mail</artifactId>
<version>${simple-java-mail.version}</version>
<exclusions>
<exclusion>
<artifactId>org.eclipse.angus</artifactId>
<groupId>angus-mail</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-activation</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-mail</artifactId>
<version>2.0.3</version>
</dependency>
dependency:tree then shows:
+- org.simplejavamail:simple-java-mail:jar:8.11.2:compile
| +- org.simplejavamail:core-module:jar:8.11.2:compile
| | \- com.sanctionco.jmail:jmail:jar:1.4.1:compile
| +- com.github.bbottema:jetbrains-runtime-annotations:jar:1.0.2:compile
| \- com.pivovarit:throwing-function:jar:1.5.1:compile
+- org.eclipse.angus:angus-activation:jar:2.0.2:compile
| \- jakarta.activation:jakarta.activation-api:jar:2.1.2:compile
\- org.eclipse.angus:angus-mail:jar:2.0.3:compile
\- jakarta.mail:jakarta.mail-api:jar:2.1.2:compile
... and mail works again. I haven't tried using non-springboot project, I assume that would work since 489 was made half a year ago. Any ideas on what is the conflict, and how to keep my pom cleaner than adding that mess to the subproject?