Can't see why JavaMail doesn't work in a Spring MVC application on Tomcat
- by Kartoch
I have wrote a small web application using Spring MVC. It runs on tomcat and use the JavaMail library. At the present time I can't find why the mails are not sent. But I have no pertinent log messages in tomcat log files to find where is the problem.
At the present time, my logging is configured in a log4j.properties file in the root of my CLASSPATH:
log4j.rootLogger= DEBUG, CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
How can i see the java mail log message in debug mode ? I think it is related to JDK logging system (as I'm using Sun's JavaMail) but I don't know how to configure it.
Edit: Well, one problem solves and another arises. I change my bean definition to include debug support for javamail:
mail.debug=true
But still no pertinent info in it:
DEBUG: JavaMail version 1.4.1ea-SNAPSHOT
DEBUG: not loading file: /usr/lib/jvm/java-6-sun-1.6.0.12/jre/lib/javamail.providers
DEBUG: java.io.FileNotFoundException: /usr/lib/jvm/java-6-sun-1.6.0.12/jre/lib/javamail.providers (No such file or directory)
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.providers
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name:{com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun
Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun
Microsystems, Inc]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun
Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun
Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun
Microsystems, Inc],
pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun
Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun
Microsystems, Inc],
smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
Microsystems, Inc]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.address.map
DEBUG: not loading file: /usr/lib/jvm/java-6-sun-1.6.0.12/jre/lib/javamail.address.map
DEBUG: java.io.FileNotFoundException: /usr/lib/jvm/java-6-sun-1.6.0.12/jre/lib/javamail.address.map (No such file or directory)