I’m using jakarta.mail to send an email, and when I create the session (through Session.getDefaultInstance) I get the following stacktrace:
java.lang.ClassNotFoundException: com.sun.mail.util.LineInputStream
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1353)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1165)
at jakarta.mail.Session.loadProvidersFromStream(Session.java:1021)
at jakarta.mail.Session.access$000(Session.java:191)
at jakarta.mail.Session$2.load(Session.java:951)
at jakarta.mail.Session.loadAllResources(Session.java:1217)
at jakarta.mail.Session.loadProviders(Session.java:970)
at jakarta.mail.Session.<init>(Session.java:254)
at jakarta.mail.Session.getDefaultInstance(Session.java:355)
I don’t know where the reference to com.sun.mail.util is coming from.
I have tried looking for any jar referencing mail in my dependencies and excluded them all except for the Jakarta one, and I’m still getting the exception.
I’m running this on a Tomcat 10, OpenJDK17.
New contributor
Little Oni Evans is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.