commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rodrigo Canabrava" <canab...@gmail.com>
Subject Re: Using commens-email from Tomcat application
Date Thu, 12 Apr 2007 14:03:19 GMT
Hi Ralf,

I don't know if you already figured it out, but it probably is a jar
conflict. JBoss already has a mail.jar, and it doesn't have the
MailDateFormat class. So probably the tomcat has one such jar either, and
it's causing the conflict.

Rodrigo


2007/4/9, Ralf Schneider <ml@tapfere-schneiderleins.de>:
>
> Hi,
>
> I want to use Commons Email 1.0 from within a Tomcat web application
> (Tomcat
> 5.5.20). I added commons-email-1.0.jar, mail.jar (Javamail 1.4) and
> activation.jar to the WEB-INF/lib directory. Here is a part of my code:
>
>         HtmlEmail email=new HtmlEmail();
>         email.setHostName               (mailConfig.getProperty("
> mail.smtpHost"));
>         email.setAuthentication (mailConfig.getProperty("mail.smtpUsername
> "),
>
> mailConfig.getProperty("mail.smtpPassword"));
>         email.setFrom                   (fromAddress, fromName);
>         email.setTo                             (toAddresses);
>         email.setSubject                        (subject);
>         email.setHtmlMsg                        (htmlMessage);
>         email.setTextMsg                        (textMessage);
>         email.send();
>
> Unfortunately, I get a NoClassDefFoundError with the last line:
>
> [...]
> Caused by: java.lang.NoClassDefFoundError:
> com/sun/mail/util/MailDateFormat
>         at org.apache.commons.mail.Email.buildMimeMessage(Email.java:749)
>         at
> org.apache.commons.mail.MultiPartEmail.buildMimeMessage(
> MultiPartEmail.java:251)
>         at org.apache.commons.mail.HtmlEmail.buildMimeMessage(
> HtmlEmail.java:229)
>         at org.apache.commons.mail.Email.send(Email.java:897)
>         at de.chrisbee.util.mail.Emailer.sendEmail(Emailer.java:83)
>         at de.chrisbee.actions.OrderAction.submitOrder(OrderAction.java
> :885)
>         at de.chrisbee.actions.OrderAction.nextStep(OrderAction.java:242)
>         at de.chrisbee.actions.OrderAction.next6_onClick(OrderAction.java
> :144)
>         ... 30 more
>
> The class MailDateFormat is part of mail.jar. So the question is: Why is
> it
> not found? May there be a JAR file confict? Which are potential candidates
> for that?
>
> Best regards,
> Ralf.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message