I'am developing a webapp using google app engine and maven in intelliJ IDEA.
So far so good until I tried to send an email using javax.mail
and I get this error:
java.lang.NoClassDefFoundError: javax/activation/DataContentHandler
I have already put the dependencies needed (javax.activation
& javax.mail
) in the pom.xml
and still this error occurs.
One way to fix it locally is to add "--add-modules java.activation" in vm options and when i run it locally its working fine and sending the email, but when I'am deploying the app its not working.
And my question is, is there any way to pass the vm argument to maven or anywhere else so it will run without the error when I'll deploy the app.
Or is there any other way to do this (with javax.mail
or not) ?
My java version is: openjdk 10.0.2
Just include the java.activation module in your application.
You can use either the older Oracle version, or the newer Eclipse version, which is essentially the same.
(And you should consider upgrading to JDK 11.)