jQuery in Action, 2nd edition*
The moose likes Other Open Source Projects and the fly likes SMTP Appender problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "SMTP Appender problem" Watch "SMTP Appender problem" New topic
Author

SMTP Appender problem

krishnakumar K R
Greenhorn

Joined: Oct 27, 2005
Posts: 12
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
Marshal

Joined: Mar 22, 2005
Posts: 42046
    
  64
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.


Ping & DNS - my free Android networking tools app
krishnakumar K R
Greenhorn

Joined: Oct 27, 2005
Posts: 12
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
Marshal

Joined: Mar 22, 2005
Posts: 42046
    
  64
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

Joined: Oct 27, 2005
Posts: 12
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..
 
GeeCON Prague 2014
 
subject: SMTP Appender problem