Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

NoClassDefFoundError when creating new MimeMessage

843830Apr 9 2007 — edited Apr 9 2007
Hi,

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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2007
Added on Apr 9 2007
3 comments
648 views