NoClassDefFoundError when creating new MimeMessage

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.

[996 byte] By [Enxiser34454a] at [2007-11-27 0:28:07]
# 1
You have a very, very, very old version of mail.jar somewhere in yourCLASSPATH. MailDateFormat moved to javax.mail.internet in JavaMail 1.2.
bshannona at 2007-7-11 22:28:46 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
How can I find out where the conflict is? I checked manually for an old mail.jar, but without success.
Enxiser34454a at 2007-7-11 22:28:46 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

You need to check all the jar files in your CLASSPATH. You may

need to look at the contents of each jsr file to make sure none of

them have embedded an old version of the JavaMail classes.

Also check the jre/lib/ext directory for the JDK installation you're

using.

Check all the Tomcat "lib" directories as well. There might be other

Tomcat configuration settings that point to jar files in other locations.

If all else fails, start with fresh installs of everything.

bshannona at 2007-7-11 22:28:46 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...