I am using java 11.0.4 2019-07-16 LTS
on Ubunutu 18
and Apache Tomcat 8.5
.
I created a class for sending emails that imports
import javax.mail.*;
import javax.mail.internet.*;
Now, when I used java 8
I did not have any problems with sending my emails. However, now it does not work instead I am getting a 500 error.
And having a look at my localhost.2019-08-20.log
I can find the following stacktrace:
20-Aug-2019 17:13:14.961 SEVERE [http-nio-80-exec-96] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [mlc.servlets.DispatcherServlet] in context with path [] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: javax.activation.DataHandler
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1360)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1182)
at mlc.Mailer.sendEMail(Mailer.java:35)
...and so on...
Doing some research I think the problem is that the module java.activation
is not loaded.
However, I did not find any solution on the internet. I only found that java.activation
has been removed from java 11. So, I guess I need something else.
So, my questions: What do I have to do that my webapp can - again - send emails using Tomcat 8.5?
Thanks
JavaBeans Activation Framework (JAF) is possibly the alternative you are looking for to the existing package.
Include the latest version of javax.activation in your program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With