Search code examples
javaeclipsejakarta-eejakarta-maileclipse-luna

Sending mail from Java: works in Eclipse but fails when deployed?


I'm getting a java.lang.NoClassDefFoundError: javax/mail/MessagingException when trying to deploy my mail-sending application to a production environment.

It works fine in the IDE (Eclipse Luna).

All jars found in the project path are present in the production environment.

There appears to be some magic dependency which is not shown as a Referenced Library in the project.

What's the quickest fix?


Solution

  • A NoClassDefFoundError and a ClassNotFoundException typically indicate that your classpath is missing relevant classes, javax.mail.MessagingException in this case

    The class javax.mail.MessagingException is part of the Java EE library. You can download it here (download the JAR if you are not using Maven). Add the library to your runtime classpath. Perhaps it was managed differently by your IDE.