jetty / jetty.project

Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
https://eclipse.dev/jetty
Other
3.83k stars 1.91k forks source link

Mail not working with jetty 9.4.43.v20210629 and java 11.0.17. #10101

Closed anasokan closed 1 year ago

anasokan commented 1 year ago

I am using jetty 9.4.43.v20210629 and java 11.0.17. I am having a java code to send email which creates MimeMessage(javax.mail.internet.MimeMessage) class with new MimeMessage(session). This is not working. I get NoClassDefFoundError exception when new MimeMessage() is called.

When using jetty 9.4.43.v20210629 and java 1.8.0 it works. When using a standalond java application with -cp pointing to jetty WEB-INF/lib/ and this also works.

I am using javax.mail-1.6.2.jar. Also activation-1.1.jar and javax.activation-api-1.2.0.jar were present in the lib folder.

I made a grep of javax.mail in lib folder and see only its present in javax.mail-1.6.2.jar

Any reason or solution to this ?

joakime commented 1 year ago

Jetty 9.x is now at End of Community Support

See:

If this happens in Jetty 10 or Jetty 11 or Jetty 12 with a known Jakarta Mail implementation (not just an API/Spec jar), comment in this issue, and we'll be happy to reopen.

sbordet commented 1 year ago

Between Java 8 and Java 11 some classes that were present in the JDK were removed.

You are apparently hitting such a case, so you should double-check all your dependencies, figure out exactly what class cannot be loaded, and verify where that class was in Java 8 and where it is supposed to be in Java 11.