• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SMTP Appender problem

 
krishnakumar K R
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I'm using mail appender in my application. But not able to get it working. I have some other appender(file) also but it is working fine.

Log4j version is 1.2.12. java version 1.4.2_05.

It throws the following exception ::
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Multipart
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:1618)
at java.lang.Class.getConstructor0(Class.java:1930)
at java.lang.Class.newInstance0(Class.java:278)
at java.lang.Class.newInstance(Class.java:261)
at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:174)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:150)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:163)
at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:425)
at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:345)
at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:827)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:712)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:604)
at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:733)
at
----------------

The appender configuration is below ;;;
---------------
<appender name="Mail" class="org.apache.log4j.net.SMTPAppender">
<param name="Threshold" value="info"/>
<param name="To" value="mail id "/>
<param name ="From" value="mail id"/>
<param name="Subject" value="LOG4j mail testing"/>
<param name="SMTPHost" value="smtphost"/>
<layout class="org.apache.log4j.PattrenLayout">
<param name="ConversionPattern" value="%d %-5p %-17c{2} (%30F:%L) %3x - %m%n"/>
</layout>
</appender>

Thanks for your help.

Regards,
Krish
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to install the JavaMail API, which you can download from java.sun.com. It usually comes in two jar files, named mail-{version}.jar and activation-{version}.jar.
 
krishnakumar K R
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

After placing the Mail.jar and activation.jar in the classpath the exception disappears..But the no mail has been sent. Did i miss any thing in my configuration file?

Please guide me..

Regards,
Krish
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Several possible problems suggest themselves:
- you've misspelt the class name of the appender
- there is no proper address to send the email to
- Is your mail host really named "smtphost" ?
 
krishnakumar K R
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Thanks for ur reply..
The probrlm is every logging requests made to the Mailappender is with Level below ERROR, hence no mails have been sent.So once i made some requests with FATAL it worked

Thanks,
Krish..
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic