NoClassDefFoundError when creating new MimeMessage
843830Apr 9 2007 — edited Apr 9 2007Hi,
I get a NoClassDefFoundError when creating a new MimeMessage object from within a Tomcat web application (Tomcat 5.5.20 and Javamail 1.4). Here is my code:
Session session = Session.getDefaultInstance( mailConfig, null );
MimeMessage message = new MimeMessage( session );
The exception is:
Caused by: java.lang.NoClassDefFoundError: com/sun/mail/util/MailDateFormat
at de.chrisbee.util.mail.Emailer.sendEmail(Emailer.java:79)
at de.chrisbee.actions.OrderAction.submitOrder(OrderAction.java:885)
at de.chrisbee.actions.OrderAction.nextStep(OrderAction.java:242)
Why does the MimeMessage constructor uses the wrong package? In the mail.jar included in the web applications WEB-INF/lib directory the MailDateFormat class is located in the package javax.mail.internet. What is the problem here?
Other posts in the forum suggested a conflict with j2ee.jar, but it's not part of my web application.
Best regards,
Ralf.