smtpappender broken in 1.2.9

Hi, I upgraded logback to 1.2.9 (from 1.2.3) in my webapp (running under tomcat) and now my SMTPAppender configuration is not working. I have file appenders configured too, but they are all working. Relevant config from logback.xml : <property name="SERVER_NAME" value="XXX" /> <property name="CONTEXT_PATH" value="XXX" /> <property name="LOG_DIR" value="${catalina.base}/logs/${CONTEXT_PATH}" scope="system" /> <appender name="email" class="ch.qos.logback.classic.net.SMTPAppender"> <sessionViaJNDI>true</sessionViaJNDI> <jndiLocation>java:comp/env/mail/XXX</jndiLocation> <to>XXX</to> <from>XXX</from> <subject>XXX</subject> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%date{HH:mm:ss.SSS} [%thread] [%level] %logger#%line %n%n%mdc%n%message%n</pattern> </layout> <cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker"> <bufferSize>1</bufferSize> </cyclicBufferTracker> <includeCallerData>true</includeCallerData> </appender> Relevant resource definition in context.xml <Resource name="mail/XXX" auth="Container" type="javax.mail.Session" mail.transport.protocol="smtps" mail.smtp.starttls.enable="true" mail.smtp.host="XXX" mail.smtp.port="587" /> Found in tomcat's default log: 23:51:33,656 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.net.SMTPAppender] 23:51:33,669 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [email] 23:51:33,711 |-INFO in ch.qos.logback.classic.net.SMTPAppender[email] - Looking up javax.mail.Session at JNDI location [java:comp/env/mail/XXX] 23:51:33,720 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[email] - Failed to obtain javax.mail.Session from JNDI location [java:comp/env/mail/XXX] 23:51:33,720 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[email] - Failed to obtain javax.mail.Session. Cannot start. Nothing else was changed, I just uploaded the new jars and restarted tomcat and now it fails. Downgraded to 1.2.7 and SMTPAppender works again.

Hi Chris, It looks to me that you are using 1.2.8. Please check both logback-core and logback-classic artifacts. Let us know if that was the case, -- Ceki Gülcü Please contact suppport(at)qos.ch for donations, sponsorship or support contracts related to SLF4J or logback projects. On 21/12/2021 01:45, Chris Cheshire wrote:
Hi,
I upgraded logback to 1.2.9 (from 1.2.3) in my webapp (running under tomcat) and now my SMTPAppender configuration is not working. I have file appenders configured too, but they are all working.
Relevant config from logback.xml :
<property name="SERVER_NAME" value="XXX" /> <property name="CONTEXT_PATH" value="XXX" /> <property name="LOG_DIR" value="${catalina.base}/logs/${CONTEXT_PATH}" scope="system" />
<appender name="email" class="ch.qos.logback.classic.net.SMTPAppender"> <sessionViaJNDI>true</sessionViaJNDI> <jndiLocation>java:comp/env/mail/XXX</jndiLocation> <to>XXX</to> <from>XXX</from> <subject>XXX</subject> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%date{HH:mm:ss.SSS} [%thread] [%level] %logger#%line %n%n%mdc%n%message%n</pattern> </layout> <cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker"> <bufferSize>1</bufferSize> </cyclicBufferTracker> <includeCallerData>true</includeCallerData> </appender>
Relevant resource definition in context.xml <Resource name="mail/XXX" auth="Container" type="javax.mail.Session" mail.transport.protocol="smtps" mail.smtp.starttls.enable="true" mail.smtp.host="XXX" mail.smtp.port="587" />
Found in tomcat's default log:
23:51:33,656 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.net.SMTPAppender] 23:51:33,669 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [email] 23:51:33,711 |-INFO in ch.qos.logback.classic.net.SMTPAppender[email] - Looking up javax.mail.Session at JNDI location [java:comp/env/mail/XXX] 23:51:33,720 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[email] - Failed to obtain javax.mail.Session from JNDI location [java:comp/env/mail/XXX] 23:51:33,720 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[email] - Failed to obtain javax.mail.Session. Cannot start.
Nothing else was changed, I just uploaded the new jars and restarted tomcat and now it fails. Downgraded to 1.2.7 and SMTPAppender works again.

Ceki, I don't use the maven build system - I downloaded manually from the repo linked on the download page. Redownloaded this morning and compared - same files (core & classic) as I downloaded yesterday. Did the build for 1.2.9 miss a commit? Chris On Tue, Dec 21, 2021 at 3:26 AM Ceki Gülcü <ceki@qos.ch> wrote:
Hi Chris,
It looks to me that you are using 1.2.8. Please check both logback-core and logback-classic artifacts.
Let us know if that was the case, -- Ceki Gülcü
Please contact suppport(at)qos.ch for donations, sponsorship or support contracts related to SLF4J or logback projects.
On 21/12/2021 01:45, Chris Cheshire wrote:
Hi,
I upgraded logback to 1.2.9 (from 1.2.3) in my webapp (running under tomcat) and now my SMTPAppender configuration is not working. I have file appenders configured too, but they are all working.
Relevant config from logback.xml :
<property name="SERVER_NAME" value="XXX" /> <property name="CONTEXT_PATH" value="XXX" /> <property name="LOG_DIR" value="${catalina.base}/logs/${CONTEXT_PATH}" scope="system" />
<appender name="email" class="ch.qos.logback.classic.net.SMTPAppender"> <sessionViaJNDI>true</sessionViaJNDI> <jndiLocation>java:comp/env/mail/XXX</jndiLocation> <to>XXX</to> <from>XXX</from> <subject>XXX</subject> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%date{HH:mm:ss.SSS} [%thread] [%level] %logger#%line %n%n%mdc%n%message%n</pattern> </layout> <cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker"> <bufferSize>1</bufferSize> </cyclicBufferTracker> <includeCallerData>true</includeCallerData> </appender>
Relevant resource definition in context.xml <Resource name="mail/XXX" auth="Container" type="javax.mail.Session" mail.transport.protocol="smtps" mail.smtp.starttls.enable="true" mail.smtp.host="XXX" mail.smtp.port="587" />
Found in tomcat's default log:
23:51:33,656 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.net.SMTPAppender] 23:51:33,669 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [email] 23:51:33,711 |-INFO in ch.qos.logback.classic.net.SMTPAppender[email] - Looking up javax.mail.Session at JNDI location [java:comp/env/mail/XXX] 23:51:33,720 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[email] - Failed to obtain javax.mail.Session from JNDI location [java:comp/env/mail/XXX] 23:51:33,720 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[email] - Failed to obtain javax.mail.Session. Cannot start.
Nothing else was changed, I just uploaded the new jars and restarted tomcat and now it fails. Downgraded to 1.2.7 and SMTPAppender works again.
logback-user mailing list logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user

I upgraded to 1.2.10 and the problem still exists. Want me to file a bug report?
On Dec 21, 2021, at 10:31, Chris Cheshire <yahoonomas@gmail.com> wrote:
Ceki,
I don't use the maven build system - I downloaded manually from the repo linked on the download page. Redownloaded this morning and compared - same files (core & classic) as I downloaded yesterday.
Did the build for 1.2.9 miss a commit?
Chris
On Tue, Dec 21, 2021 at 3:26 AM Ceki Gülcü <ceki@qos.ch> wrote:
Hi Chris,
It looks to me that you are using 1.2.8. Please check both logback-core and logback-classic artifacts.
Let us know if that was the case, -- Ceki Gülcü
Please contact suppport(at)qos.ch for donations, sponsorship or support contracts related to SLF4J or logback projects.
On 21/12/2021 01:45, Chris Cheshire wrote: Hi,
I upgraded logback to 1.2.9 (from 1.2.3) in my webapp (running under tomcat) and now my SMTPAppender configuration is not working. I have file appenders configured too, but they are all working.
Relevant config from logback.xml :
<property name="SERVER_NAME" value="XXX" /> <property name="CONTEXT_PATH" value="XXX" /> <property name="LOG_DIR" value="${catalina.base}/logs/${CONTEXT_PATH}" scope="system" />
<appender name="email" class="ch.qos.logback.classic.net.SMTPAppender"> <sessionViaJNDI>true</sessionViaJNDI> <jndiLocation>java:comp/env/mail/XXX</jndiLocation> <to>XXX</to> <from>XXX</from> <subject>XXX</subject> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%date{HH:mm:ss.SSS} [%thread] [%level] %logger#%line %n%n%mdc%n%message%n</pattern> </layout> <cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker"> <bufferSize>1</bufferSize> </cyclicBufferTracker> <includeCallerData>true</includeCallerData> </appender>
Relevant resource definition in context.xml <Resource name="mail/XXX" auth="Container" type="javax.mail.Session" mail.transport.protocol="smtps" mail.smtp.starttls.enable="true" mail.smtp.host="XXX" mail.smtp.port="587" />
Found in tomcat's default log:
23:51:33,656 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.net.SMTPAppender] 23:51:33,669 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [email] 23:51:33,711 |-INFO in ch.qos.logback.classic.net.SMTPAppender[email] - Looking up javax.mail.Session at JNDI location [java:comp/env/mail/XXX] 23:51:33,720 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[email] - Failed to obtain javax.mail.Session from JNDI location [java:comp/env/mail/XXX] 23:51:33,720 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[email] - Failed to obtain javax.mail.Session. Cannot start.
Nothing else was changed, I just uploaded the new jars and restarted tomcat and now it fails. Downgraded to 1.2.7 and SMTPAppender works again.
logback-user mailing list logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user

Hi Chris, Just checked, there is an incorrect type cast. Sorry about that. Please file a report. -- Ceki Gülcü Please contact suppport(at)qos.ch for donations, sponsorship or support contracts related to SLF4J or logback projects. This Have you tried with 1.2.5? On 24/12/2021 17:59, Chris Cheshire wrote:
I upgraded to 1.2.10 and the problem still exists. Want me to file a bug report?
On Dec 21, 2021, at 10:31, Chris Cheshire <yahoonomas@gmail.com> wrote:
Ceki,
I don't use the maven build system - I downloaded manually from the repo linked on the download page. Redownloaded this morning and compared - same files (core & classic) as I downloaded yesterday.
Did the build for 1.2.9 miss a commit?
Chris
On Tue, Dec 21, 2021 at 3:26 AM Ceki Gülcü <ceki@qos.ch> wrote:
Hi Chris,
It looks to me that you are using 1.2.8. Please check both logback-core and logback-classic artifacts.
Let us know if that was the case, -- Ceki Gülcü
Please contact suppport(at)qos.ch for donations, sponsorship or support contracts related to SLF4J or logback projects.
On 21/12/2021 01:45, Chris Cheshire wrote: Hi,
I upgraded logback to 1.2.9 (from 1.2.3) in my webapp (running under tomcat) and now my SMTPAppender configuration is not working. I have file appenders configured too, but they are all working.
Relevant config from logback.xml :
<property name="SERVER_NAME" value="XXX" /> <property name="CONTEXT_PATH" value="XXX" /> <property name="LOG_DIR" value="${catalina.base}/logs/${CONTEXT_PATH}" scope="system" />
<appender name="email" class="ch.qos.logback.classic.net.SMTPAppender"> <sessionViaJNDI>true</sessionViaJNDI> <jndiLocation>java:comp/env/mail/XXX</jndiLocation> <to>XXX</to> <from>XXX</from> <subject>XXX</subject> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%date{HH:mm:ss.SSS} [%thread] [%level] %logger#%line %n%n%mdc%n%message%n</pattern> </layout> <cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker"> <bufferSize>1</bufferSize> </cyclicBufferTracker> <includeCallerData>true</includeCallerData> </appender>
Relevant resource definition in context.xml <Resource name="mail/XXX" auth="Container" type="javax.mail.Session" mail.transport.protocol="smtps" mail.smtp.starttls.enable="true" mail.smtp.host="XXX" mail.smtp.port="587" />
Found in tomcat's default log:
23:51:33,656 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.net.SMTPAppender] 23:51:33,669 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [email] 23:51:33,711 |-INFO in ch.qos.logback.classic.net.SMTPAppender[email] - Looking up javax.mail.Session at JNDI location [java:comp/env/mail/XXX] 23:51:33,720 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[email] - Failed to obtain javax.mail.Session from JNDI location [java:comp/env/mail/XXX] 23:51:33,720 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[email] - Failed to obtain javax.mail.Session. Cannot start.
Nothing else was changed, I just uploaded the new jars and restarted tomcat and now it fails. Downgraded to 1.2.7 and SMTPAppender works again.
logback-user mailing list logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
logback-user mailing list logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
participants (2)
-
Ceki Gülcü
-
Chris Cheshire