You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Sky USC <sk...@hotmail.com> on 2010/11/19 07:50:44 UTC

Log4J SMTPAppender fails for wicket app but works for a non-wicket Java application.

Hi.
I created a wicket application. SMTPappender for Log4J fails with my wicket application. When I use the EXACT same log4j setting file in a non-maven, non-wicket basic hello world Java project, I dont see the failure happen and mail works fine. Any idea what could be different of a wicket/web application than a basic hello world java application?
Thx. 


-----------------------------------------------------
my log4j setting

log4j.rootLogger=WARN,Stdout,infoFile,warnFile,emailer

#### Appenders: SMTP Appender 
log4j.appender.emailer=org.apache.log4j.net.SMTPAppender
log4j.appender.emailer.BufferSize=2
log4j.appender.emailer.SMTPHost=mail.<validdomain>.com
log4j.appender.emailer.SMTPUsername=<calidusername>
log4j.appender.emailer.SMTPPassword=<validpwd>
log4j.appender.emailer.From=notifier@<myvaliddomain.com>
log4j.appender.emailer.To=<validrecepient>@hotmail.com
log4j.appender.emailer.Subject=ES-log
log4j.appender.emailer.layout=org.apache.log4j.PatternLayout
log4j.appender.emailer.layout.conversionPattern=%d{DATE} %-5p %m - %c{3} [%t] [%r ms]%n%n
log4j.appender.emailer.Threshold=ERROR
log4j.appender.emailer.SMTPDebug=true



-----------------------------------------------------
error message: 
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "mail.blewski.com", port 25, isSSL false
DEBUG SMTP: exception reading response: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
log4j:ERROR Error occured while sending e-mail notification.
javax.mail.MessagingException: Exception reading response;
  nested exception is:
        javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

-------------------------------------
My pom.xml:

        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.1</version>
        </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.4.2</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
      <dependency>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
          <version>1.2.16</version>
          <type>jar</type>
          <classifier></classifier>
          <scope>compile</scope>
      </dependency>
      <dependency>
          <groupId>log4j</groupId>
          <artifactId>apache-log4j-extras</artifactId>
          <version>1.0</version>
          <type>jar</type>
          <scope>compile</scope>
      </dependency>



 		 	   		  

RE: Log4J SMTPAppender fails for wicket app but works for a non-wicket Java application.

Posted by Sky USC <sk...@hotmail.com>.
Please disregard the issue. 
During initially trying to get SMTPAppender, I had added a line in my program which was unnecessary, and discovered it after I had already sent the email below.

System.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");

> From: skyusc@hotmail.com
> To: users@wicket.apache.org
> Subject: Log4J SMTPAppender fails for wicket app but works for a non-wicket Java application.
> Date: Thu, 18 Nov 2010 22:50:44 -0800
> 
> 
> Hi.
> I created a wicket application. SMTPappender for Log4J fails with my wicket application. When I use the EXACT same log4j setting file in a non-maven, non-wicket basic hello world Java project, I dont see the failure happen and mail works fine. Any idea what could be different of a wicket/web application than a basic hello world java application?
> Thx. 
> 
> 
> -----------------------------------------------------
> my log4j setting
> 
> log4j.rootLogger=WARN,Stdout,infoFile,warnFile,emailer
> 
> #### Appenders: SMTP Appender 
> log4j.appender.emailer=org.apache.log4j.net.SMTPAppender
> log4j.appender.emailer.BufferSize=2
> log4j.appender.emailer.SMTPHost=mail.<validdomain>.com
> log4j.appender.emailer.SMTPUsername=<calidusername>
> log4j.appender.emailer.SMTPPassword=<validpwd>
> log4j.appender.emailer.From=notifier@<myvaliddomain.com>
> log4j.appender.emailer.To=<validrecepient>@hotmail.com
> log4j.appender.emailer.Subject=ES-log
> log4j.appender.emailer.layout=org.apache.log4j.PatternLayout
> log4j.appender.emailer.layout.conversionPattern=%d{DATE} %-5p %m - %c{3} [%t] [%r ms]%n%n
> log4j.appender.emailer.Threshold=ERROR
> log4j.appender.emailer.SMTPDebug=true
> 
> 
> 
> -----------------------------------------------------
> error message: 
> DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
> DEBUG SMTP: useEhlo true, useAuth true
> DEBUG SMTP: useEhlo true, useAuth true
> DEBUG SMTP: trying to connect to host "mail.blewski.com", port 25, isSSL false
> DEBUG SMTP: exception reading response: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
> log4j:ERROR Error occured while sending e-mail notification.
> javax.mail.MessagingException: Exception reading response;
>   nested exception is:
>         javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
> 
> -------------------------------------
> My pom.xml:
> 
>         <dependency>
>             <groupId>javax.mail</groupId>
>             <artifactId>mail</artifactId>
>             <version>1.4.1</version>
>         </dependency>
>     <dependency>
>         <groupId>org.slf4j</groupId>
>         <artifactId>slf4j-log4j12</artifactId>
>         <version>1.4.2</version>
>         <type>jar</type>
>         <scope>compile</scope>
>     </dependency>
>       <dependency>
>           <groupId>log4j</groupId>
>           <artifactId>log4j</artifactId>
>           <version>1.2.16</version>
>           <type>jar</type>
>           <classifier></classifier>
>           <scope>compile</scope>
>       </dependency>
>       <dependency>
>           <groupId>log4j</groupId>
>           <artifactId>apache-log4j-extras</artifactId>
>           <version>1.0</version>
>           <type>jar</type>
>           <scope>compile</scope>
>       </dependency>
> 
> 
> 
>