Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Boot 3 logback smtp appender incompatibility #36641

Closed
robozb opened this issue Jul 30, 2023 · 13 comments
Closed

Spring Boot 3 logback smtp appender incompatibility #36641

robozb opened this issue Jul 30, 2023 · 13 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@robozb
Copy link

robozb commented Jul 30, 2023

Dear All,

I experienced a strange behavior of Spring using Logback and SMTP appender. It seems, there is an incompatibility between the latest Spring version and Logback SMTP appender.

Logback file:

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
https://howtodoinjava.com/spring-boot2/logging/profile-specific-logging/
https://howtodoinjava.com/spring-boot2/logging/profile-specific-logging/
-->
<configuration>
    <include resource="org/springframework/boot/logging/logback/defaults.xml" />
    <include resource="org/springframework/boot/logging/logback/console-appender.xml" />
        
    <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
        <smtpHost>...</smtpHost>
        <to>...</to>
        <from>...</from>
        <subject>...</subject>
        <layout class="ch.qos.logback.classic.PatternLayout">
            <pattern>%date %-5level %logger{35} - %message%n</pattern>
        </layout>    
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>ERROR</level>
        </filter>   
    </appender>                                    
        
    <root level="INFO">
          <appender-ref ref="EMAIL" />
    </root>

</configuration>

Dependency for logback smtp:

  <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
  </dependency> 

Exception:

--- spring-boot-maven-plugin:3.1.2:run (default-cli) @ vsm-backend ---
Attaching agents: []
Logging system failed to initialize using configuration from 'null'
java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.model.processor.AppenderModelHandler - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.DefaultProcessor@6a7b85ad - Failed to traverse model appender ch.qos.logback.core.model.processor.ModelHandlerException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.AppenderModelHandler - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.DefaultProcessor@6a7b85ad - Failed to traverse model appender ch.qos.logback.core.model.processor.ModelHandlerException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.reportConfigurationErrorsIfNecessary(LogbackLoggingSystem.java:260)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:247)
	at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:80)
	at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:187)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:332)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:298)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:246)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:223)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
	at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:81)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:64)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:63)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:356)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
	at hu.wfs.vsm.ManagerApplication.main(ManagerApplication.java:27)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50)
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50)
Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.model.processor.AppenderModelHandler - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.DefaultProcessor@6a7b85ad - Failed to traverse model appender ch.qos.logback.core.model.processor.ModelHandlerException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.AppenderModelHandler - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.DefaultProcessor@6a7b85ad - Failed to traverse model appender ch.qos.logback.core.model.processor.ModelHandlerException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:347)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:298)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:246)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:223)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
	at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:81)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:64)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:63)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:356)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
	at hu.wfs.vsm.ManagerApplication.main(ManagerApplication.java:27)
	... 5 more
Caused by: java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.model.processor.AppenderModelHandler - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.DefaultProcessor@6a7b85ad - Failed to traverse model appender ch.qos.logback.core.model.processor.ModelHandlerException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.AppenderModelHandler - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.DefaultProcessor@6a7b85ad - Failed to traverse model appender ch.qos.logback.core.model.processor.ModelHandlerException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.reportConfigurationErrorsIfNecessary(LogbackLoggingSystem.java:260)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:247)
	at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:80)
	at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:187)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:332)
	... 24 more
@robozb
Copy link
Author

robozb commented Jul 30, 2023

The exception without the additional dependency:

--- spring-boot-maven-plugin:3.1.2:run (default-cli) @ vsm-backend ---
Attaching agents: []
Logging system failed to initialize using configuration from 'null'
java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.model.processor.AppenderModelHandler - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.DefaultProcessor@376c02bf - Failed to traverse model appender ch.qos.logback.core.model.processor.ModelHandlerException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.AppenderModelHandler - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.DefaultProcessor@376c02bf - Failed to traverse model appender ch.qos.logback.core.model.processor.ModelHandlerException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.reportConfigurationErrorsIfNecessary(LogbackLoggingSystem.java:260)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:247)
	at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:80)
	at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:187)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:332)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:298)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:246)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:223)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
	at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:81)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:64)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:63)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:356)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
	at hu.wfs.vsm.ManagerApplication.main(ManagerApplication.java:27)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50)
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50)
Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.model.processor.AppenderModelHandler - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.DefaultProcessor@376c02bf - Failed to traverse model appender ch.qos.logback.core.model.processor.ModelHandlerException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.AppenderModelHandler - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.DefaultProcessor@376c02bf - Failed to traverse model appender ch.qos.logback.core.model.processor.ModelHandlerException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:347)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:298)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:246)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:223)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
	at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:81)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:64)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:63)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:356)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
	at hu.wfs.vsm.ManagerApplication.main(ManagerApplication.java:27)
	... 5 more
Caused by: java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.model.processor.AppenderModelHandler - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.DefaultProcessor@376c02bf - Failed to traverse model appender ch.qos.logback.core.model.processor.ModelHandlerException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.AppenderModelHandler - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.model.processor.DefaultProcessor@376c02bf - Failed to traverse model appender ch.qos.logback.core.model.processor.ModelHandlerException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.reportConfigurationErrorsIfNecessary(LogbackLoggingSystem.java:260)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:247)
	at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:80)
	at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:187)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:332)
	... 24 more

@robozb
Copy link
Author

robozb commented Jul 30, 2023

Thanks for any help!!!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 30, 2023
@robozb
Copy link
Author

robozb commented Jul 30, 2023

I don't understand, there is the class file:

image

@robozb
Copy link
Author

robozb commented Jul 30, 2023

The dependencies:

hu.wfs.vau:vsm-backend:jar:0.0.11-SNAPSHOT
+- org.springframework.boot:spring-boot-starter-web:jar:3.1.2:compile
|  +- org.springframework.boot:spring-boot-starter:jar:3.1.2:compile
|  |  +- org.springframework.boot:spring-boot-starter-logging:jar:3.1.2:compile
|  |  |  +- ch.qos.logback:logback-classic:jar:1.4.8:compile
|  |  |  |  \- ch.qos.logback:logback-core:jar:1.4.8:compile
|  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.20.0:compile
|  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.20.0:compile
|  |  |  \- org.slf4j:jul-to-slf4j:jar:2.0.7:compile
|  |  +- jakarta.annotation:jakarta.annotation-api:jar:2.1.1:compile
|  |  \- org.yaml:snakeyaml:jar:1.33:compile
|  +- org.springframework.boot:spring-boot-starter-json:jar:3.1.2:compile
|  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.15.2:compile
|  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.15.2:compile
|  +- org.springframework.boot:spring-boot-starter-tomcat:jar:3.1.2:compile
|  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:10.1.11:compile
|  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:10.1.11:compile
|  +- org.springframework:spring-web:jar:6.0.11:compile
|  |  \- org.springframework:spring-beans:jar:6.0.11:compile
|  \- org.springframework:spring-webmvc:jar:6.0.11:compile
|     +- org.springframework:spring-context:jar:6.0.11:compile
|     \- org.springframework:spring-expression:jar:6.0.11:compile
+- org.springframework.boot:spring-boot-devtools:jar:3.1.2:runtime
|  +- org.springframework.boot:spring-boot:jar:3.1.2:compile
|  \- org.springframework.boot:spring-boot-autoconfigure:jar:3.1.2:compile
+- org.springframework.boot:spring-boot-starter-test:jar:3.1.2:test
|  +- org.springframework.boot:spring-boot-test:jar:3.1.2:test
|  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:3.1.2:test
|  +- com.jayway.jsonpath:json-path:jar:2.8.0:test
|  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:4.0.0:compile
|  |  \- jakarta.activation:jakarta.activation-api:jar:2.1.2:compile
|  +- net.minidev:json-smart:jar:2.4.11:test
|  |  \- net.minidev:accessors-smart:jar:2.4.11:test
|  |     \- org.ow2.asm:asm:jar:9.3:compile
|  +- org.assertj:assertj-core:jar:3.24.2:test
|  |  \- net.bytebuddy:byte-buddy:jar:1.14.5:runtime
|  +- org.hamcrest:hamcrest:jar:2.2:test
|  +- org.junit.jupiter:junit-jupiter:jar:5.9.3:test
|  |  +- org.junit.jupiter:junit-jupiter-api:jar:5.9.3:test
|  |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
|  |  |  +- org.junit.platform:junit-platform-commons:jar:1.9.3:test
|  |  |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
|  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.9.3:test
|  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.9.3:test
|  |     \- org.junit.platform:junit-platform-engine:jar:1.9.3:test
|  +- org.mockito:mockito-core:jar:5.3.1:test
|  |  +- net.bytebuddy:byte-buddy-agent:jar:1.14.5:test
|  |  \- org.objenesis:objenesis:jar:3.3:test
|  +- org.mockito:mockito-junit-jupiter:jar:5.3.1:test
|  +- org.skyscreamer:jsonassert:jar:1.5.1:test
|  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
|  +- org.springframework:spring-core:jar:6.0.11:compile
|  |  \- org.springframework:spring-jcl:jar:6.0.11:compile
|  +- org.springframework:spring-test:jar:6.0.11:test
|  \- org.xmlunit:xmlunit-core:jar:2.9.1:test
+- org.slf4j:log4j-over-slf4j:jar:2.0.7:compile
|  \- org.slf4j:slf4j-api:jar:2.0.7:compile
+- net.bull.javamelody:javamelody-spring-boot-starter:jar:2.0.0:compile
|  +- net.bull.javamelody:javamelody-core:jar:2.0.0:compile
|  |  \- org.jrobin:jrobin:jar:1.5.9:compile
|  \- org.springframework.boot:spring-boot-starter-aop:jar:3.1.2:compile
|     \- org.aspectj:aspectjweaver:jar:1.9.19:compile
+- org.springframework.boot:spring-boot-starter-data-jpa:jar:3.1.2:compile
|  +- org.springframework.boot:spring-boot-starter-jdbc:jar:3.1.2:compile
|  |  +- com.zaxxer:HikariCP:jar:5.0.1:compile
|  |  \- org.springframework:spring-jdbc:jar:6.0.11:compile
|  +- org.hibernate.orm:hibernate-core:jar:6.2.6.Final:compile
|  |  +- jakarta.persistence:jakarta.persistence-api:jar:3.1.0:compile
|  |  +- jakarta.transaction:jakarta.transaction-api:jar:2.0.1:compile
|  |  +- org.jboss.logging:jboss-logging:jar:3.5.3.Final:compile
|  |  +- org.hibernate.common:hibernate-commons-annotations:jar:6.0.6.Final:runtime
|  |  +- io.smallrye:jandex:jar:3.0.5:runtime
|  |  +- com.fasterxml:classmate:jar:1.5.1:compile
|  |  +- org.glassfish.jaxb:jaxb-runtime:jar:4.0.3:compile
|  |  |  \- org.glassfish.jaxb:jaxb-core:jar:4.0.3:compile
|  |  |     +- org.eclipse.angus:angus-activation:jar:2.0.1:runtime
|  |  |     +- org.glassfish.jaxb:txw2:jar:4.0.3:compile
|  |  |     \- com.sun.istack:istack-commons-runtime:jar:4.1.2:compile
|  |  +- jakarta.inject:jakarta.inject-api:jar:2.0.1:runtime
|  |  \- org.antlr:antlr4-runtime:jar:4.10.1:compile
|  +- org.springframework.data:spring-data-jpa:jar:3.1.2:compile
|  |  +- org.springframework.data:spring-data-commons:jar:3.1.2:compile
|  |  +- org.springframework:spring-orm:jar:6.0.11:compile
|  |  \- org.springframework:spring-tx:jar:6.0.11:compile
|  \- org.springframework:spring-aspects:jar:6.0.11:compile
+- org.springframework.boot:spring-boot-starter-security:jar:3.1.2:compile
|  +- org.springframework:spring-aop:jar:6.0.11:compile
|  +- org.springframework.security:spring-security-config:jar:6.1.2:compile
|  \- org.springframework.security:spring-security-web:jar:6.1.2:compile
+- org.springframework.boot:spring-boot-starter-validation:jar:3.1.2:compile
|  +- org.apache.tomcat.embed:tomcat-embed-el:jar:10.1.11:compile
|  \- org.hibernate.validator:hibernate-validator:jar:8.0.1.Final:compile
|     \- jakarta.validation:jakarta.validation-api:jar:3.0.2:compile
+- org.springframework.security:spring-security-test:jar:6.1.2:test
|  \- org.springframework.security:spring-security-core:jar:6.1.2:compile
|     \- org.springframework.security:spring-security-crypto:jar:6.1.2:compile
+- org.springframework.boot:spring-boot-starter-oauth2-resource-server:jar:3.1.2:compile
|  +- org.springframework.security:spring-security-oauth2-resource-server:jar:6.1.2:compile
|  |  \- org.springframework.security:spring-security-oauth2-core:jar:6.1.2:compile
|  \- org.springframework.security:spring-security-oauth2-jose:jar:6.1.2:compile
|     \- com.nimbusds:nimbus-jose-jwt:jar:9.31:compile
|        \- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
+- org.springframework.boot:spring-boot-starter-thymeleaf:jar:3.1.2:compile
|  \- org.thymeleaf:thymeleaf-spring6:jar:3.1.1.RELEASE:compile
|     \- org.thymeleaf:thymeleaf:jar:3.1.1.RELEASE:compile
|        +- org.attoparser:attoparser:jar:2.0.6.RELEASE:compile
|        \- org.unbescape:unbescape:jar:1.1.6.RELEASE:compile
+- org.thymeleaf.extras:thymeleaf-extras-springsecurity6:jar:3.1.1.RELEASE:compile
+- org.springframework.boot:spring-boot-starter-actuator:jar:3.1.2:compile
|  +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:3.1.2:compile
|  |  \- org.springframework.boot:spring-boot-actuator:jar:3.1.2:compile
|  +- io.micrometer:micrometer-observation:jar:1.11.2:compile
|  |  \- io.micrometer:micrometer-commons:jar:1.11.2:compile
|  \- io.micrometer:micrometer-core:jar:1.11.2:compile
|     +- org.hdrhistogram:HdrHistogram:jar:2.1.12:runtime
|     \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
+- com.sun.mail:javax.mail:jar:1.6.2:compile
|  \- javax.activation:activation:jar:1.1:compile
+- org.passay:passay:jar:1.6.3:compile
+- com.sun.activation:jakarta.activation:jar:2.0.0:compile
+- hu.wfs.lib.halozat:WFSLib_Halozat:jar:2.7.0:compile
|  +- hu.wfs.lib.biztonsag:WFSLib_Biztonsag:jar:2.5.3:compile
|  |  +- hu.wfs.lib.altalanos:WFSLib_Altalanos:jar:2.7.2:compile
|  |  |  +- org.apache.velocity:velocity:jar:1.5:compile
|  |  |  |  +- commons-collections:commons-collections:jar:3.1:compile
|  |  |  |  +- commons-lang:commons-lang:jar:2.1:compile
|  |  |  |  \- oro:oro:jar:2.0.8:compile
|  |  |  +- net.sourceforge.jexcelapi:jxl:jar:2.6.12:compile
|  |  |  +- org.apache.poi:poi:jar:3.17:compile
|  |  |  |  \- org.apache.commons:commons-collections4:jar:4.1:compile
|  |  |  +- org.apache.poi:poi-ooxml:jar:3.17:compile
|  |  |  |  +- org.apache.poi:poi-ooxml-schemas:jar:3.17:compile
|  |  |  |  |  \- org.apache.xmlbeans:xmlbeans:jar:2.6.0:compile
|  |  |  |  |     \- stax:stax-api:jar:1.0.1:compile
|  |  |  |  \- com.github.virtuald:curvesapi:jar:1.04:compile
|  |  |  +- com.sun.xml.bind:jaxb-core:jar:4.0.3:compile
|  |  |  \- com.sun.xml.bind:jaxb-impl:jar:4.0.3:compile
|  |  +- kulsojar.bcprov_jdk16_jeloletlen_1_43:bcprov_jdk16_jeloletlen_1_43:jar:1.0.0:compile
|  |  +- ch.ethz.ganymed:ganymed-ssh2:jar:build210:compile
|  |  +- J2SSHCommon:J2SSHCommon:jar:0.2.9-patched:system
|  |  +- J2SSHCore:J2SSHCore:jar:0.2.9-patched:system
|  |  +- commons-httpclient:commons-httpclient:jar:3.0.1:compile
|  |  \- commons-logging:commons-logging:jar:1.0.4:compile
|  +- javax.mail:javax.mail-api:jar:1.6.2:compile
|  +- javax.xml.ws:jaxws-api:jar:2.3.1:compile
|  |  +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
|  |  |  \- javax.activation:javax.activation-api:jar:1.2.0:compile
|  |  +- javax.xml.soap:javax.xml.soap-api:jar:1.4.0:compile
|  |  \- javax.annotation:javax.annotation-api:jar:1.3.2:compile
|  \- org.jsoup:jsoup:jar:1.13.1:compile
+- org.projectlombok:lombok:jar:1.18.28:compile
+- org.keycloak:keycloak-admin-client:jar:21.0.1:compile
|  +- org.keycloak:keycloak-core:jar:21.0.1:compile
|  +- org.keycloak:keycloak-common:jar:21.0.1:compile
|  +- org.jboss.resteasy:resteasy-client:jar:4.7.7.Final:compile
|  |  +- org.jboss.resteasy:resteasy-client-api:jar:4.7.7.Final:compile
|  |  +- org.jboss.resteasy:resteasy-core-spi:jar:4.7.7.Final:compile
|  |  |  \- org.jboss.spec.javax.annotation:jboss-annotations-api_1.3_spec:jar:2.0.1.Final:compile
|  |  +- org.jboss.resteasy:resteasy-core:jar:4.7.7.Final:compile
|  |  |  +- com.ibm.async:asyncutil:jar:0.1.0:compile
|  |  |  \- io.smallrye.config:smallrye-config:jar:2.3.0:compile
|  |  |     \- io.smallrye.config:smallrye-config-core:jar:2.3.0:compile
|  |  |        +- org.eclipse.microprofile.config:microprofile-config-api:jar:2.0:compile
|  |  |        +- io.smallrye.common:smallrye-common-annotation:jar:1.6.0:compile
|  |  |        +- io.smallrye.common:smallrye-common-expression:jar:1.6.0:compile
|  |  |        |  \- io.smallrye.common:smallrye-common-function:jar:1.6.0:compile
|  |  |        +- io.smallrye.common:smallrye-common-constraint:jar:1.6.0:compile
|  |  |        +- io.smallrye.common:smallrye-common-classloader:jar:1.6.0:compile
|  |  |        \- io.smallrye.config:smallrye-config-common:jar:2.3.0:compile
|  |  +- org.apache.httpcomponents:httpclient:jar:4.5.13:compile
|  |  |  \- org.apache.httpcomponents:httpcore:jar:4.4.16:compile
|  |  +- commons-codec:commons-codec:jar:1.15:compile
|  |  +- commons-io:commons-io:jar:2.9.0:compile
|  |  +- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.1_spec:jar:2.0.1.Final:compile
|  |  \- org.reactivestreams:reactive-streams:jar:1.0.4:compile
|  +- org.jboss.resteasy:resteasy-multipart-provider:jar:4.7.7.Final:compile
|  |  +- com.sun.mail:jakarta.mail:jar:1.6.5:compile
|  |  +- org.apache.james:apache-mime4j-dom:jar:0.8.3:compile
|  |  |  \- org.apache.james:apache-mime4j-core:jar:0.8.3:compile
|  |  \- org.apache.james:apache-mime4j-storage:jar:0.8.3:compile
|  +- org.jboss.resteasy:resteasy-jackson2-provider:jar:4.7.7.Final:compile
|  |  +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.15.2:compile
|  |  |  +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.15.2:compile
|  |  |  \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.15.2:compile
|  |  \- com.github.java-json-tools:json-patch:jar:1.13:compile
|  |     +- com.github.java-json-tools:msg-simple:jar:1.2:compile
|  |     |  \- com.github.java-json-tools:btf:jar:1.3:compile
|  |     \- com.github.java-json-tools:jackson-coreutils:jar:2.0:compile
|  \- org.jboss.resteasy:resteasy-jaxb-provider:jar:4.7.7.Final:compile
|     \- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.3_spec:jar:2.0.0.Final:compile
+- com.mysql:mysql-connector-j:jar:8.0.33:runtime
+- io.micrometer:micrometer-registry-prometheus:jar:1.11.2:compile
|  \- io.prometheus:simpleclient_common:jar:0.16.0:compile
|     \- io.prometheus:simpleclient:jar:0.16.0:compile
|        +- io.prometheus:simpleclient_tracer_otel:jar:0.16.0:compile
|        |  \- io.prometheus:simpleclient_tracer_common:jar:0.16.0:compile
|        \- io.prometheus:simpleclient_tracer_otel_agent:jar:0.16.0:compile
+- com.github.javafaker:javafaker:jar:1.0.2:compile
|  +- org.apache.commons:commons-lang3:jar:3.12.0:compile
|  +- org.yaml:snakeyaml:jar:android:1.23:compile
|  \- com.github.mifmif:generex:jar:1.0.2:compile
|     \- dk.brics.automaton:automaton:jar:1.11-8:compile
+- org.modelmapper:modelmapper:jar:3.0.0:compile
+- com.fasterxml.jackson.core:jackson-databind:jar:2.15.2:compile
|  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.15.2:compile
|  \- com.fasterxml.jackson.core:jackson-core:jar:2.15.2:compile
\- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.15.2:compile

@robozb
Copy link
Author

robozb commented Jul 30, 2023

so far the only solution was: to change log4j2

@philwebb
Copy link
Member

Devtools can sometimes cause classloader issues, you could try temporarily removing it to see if you still get the problem.

@robozb
Copy link
Author

robozb commented Jul 30, 2023

Devtools can sometimes cause classloader issues, you could try temporarily removing it to see if you still get the problem.

Dear @philwebb, Thanks but It didn't work :(

@robozb
Copy link
Author

robozb commented Jul 30, 2023

I made a sample github project, I got the exception at this pure Springboot project as well:
https://github.com/robozb/SpringBoot3LogbackSmtpAppenderError

@philwebb
Copy link
Member

A bit of debugging in the sample shows the real cause is the following:

ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
	at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:69)
	at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:44)
	at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:33)
	at ch.qos.logback.core.model.processor.AppenderModelHandler.handle(AppenderModelHandler.java:67)
	at ch.qos.logback.core.model.processor.DefaultProcessor.secondPhaseTraverse(DefaultProcessor.java:241)
	at ch.qos.logback.core.model.processor.DefaultProcessor.secondPhaseTraverse(DefaultProcessor.java:253)
	at ch.qos.logback.core.model.processor.DefaultProcessor.traversalLoop(DefaultProcessor.java:90)
	at ch.qos.logback.core.model.processor.DefaultProcessor.process(DefaultProcessor.java:106)
	at ch.qos.logback.core.joran.GenericXMLConfigurator.processModel(GenericXMLConfigurator.java:210)
	at org.springframework.boot.logging.logback.SpringBootJoranConfigurator.processModel(SpringBootJoranConfigurator.java:122)
	at ch.qos.logback.core.joran.GenericXMLConfigurator.doConfigure(GenericXMLConfigurator.java:174)
	at ch.qos.logback.core.joran.GenericXMLConfigurator.doConfigure(GenericXMLConfigurator.java:126)
	at ch.qos.logback.core.joran.GenericXMLConfigurator.doConfigure(GenericXMLConfigurator.java:69)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.configureByResourceUrl(LogbackLoggingSystem.java:272)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:242)
	at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:80)
	at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:187)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:332)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:298)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:246)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:223)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
	at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:81)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:64)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:63)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:356)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
	at com.example.demo.DemoApplication.main(DemoApplication.java:10)
Caused by: java.lang.NoClassDefFoundError: jakarta/mail/internet/AddressException
	at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373)
	at java.base/java.lang.Class.getConstructor0(Class.java:3578)
	at java.base/java.lang.Class.getConstructor(Class.java:2271)
	at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:61)
	... 37 more
Caused by: java.lang.ClassNotFoundException: jakarta.mail.internet.AddressException
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	... 42 more
ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
	at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:69)
	at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:44)
	at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:33)
	at ch.qos.logback.core.model.processor.AppenderModelHandler.handle(AppenderModelHandler.java:67)
	at ch.qos.logback.core.model.processor.DefaultProcessor.secondPhaseTraverse(DefaultProcessor.java:241)
	at ch.qos.logback.core.model.processor.DefaultProcessor.secondPhaseTraverse(DefaultProcessor.java:253)
	at ch.qos.logback.core.model.processor.DefaultProcessor.traversalLoop(DefaultProcessor.java:90)
	at ch.qos.logback.core.model.processor.DefaultProcessor.process(DefaultProcessor.java:106)
	at ch.qos.logback.core.joran.GenericXMLConfigurator.processModel(GenericXMLConfigurator.java:210)
	at org.springframework.boot.logging.logback.SpringBootJoranConfigurator.processModel(SpringBootJoranConfigurator.java:122)
	at ch.qos.logback.core.joran.GenericXMLConfigurator.doConfigure(GenericXMLConfigurator.java:174)
	at ch.qos.logback.core.joran.GenericXMLConfigurator.doConfigure(GenericXMLConfigurator.java:126)
	at ch.qos.logback.core.joran.GenericXMLConfigurator.doConfigure(GenericXMLConfigurator.java:69)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.configureByResourceUrl(LogbackLoggingSystem.java:272)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:242)
	at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:80)
	at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:187)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:332)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:298)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:246)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:223)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
	at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:81)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:64)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:63)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:356)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
	at com.example.demo.DemoApplication.main(DemoApplication.java:10)
Caused by: java.lang.NoClassDefFoundError: jakarta/mail/internet/AddressException
	at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373)
	at java.base/java.lang.Class.getConstructor0(Class.java:3578)
	at java.base/java.lang.Class.getConstructor(Class.java:2271)
	at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:61)
	... 37 more
Caused by: java.lang.ClassNotFoundException: jakarta.mail.internet.AddressException
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	... 42 more

That can be fixed by adding a mail dependency to the POM:

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-mail</artifactId>
</dependency>

The fact the actual cause isn't reported isn't great, I've opened #36645 to see if we can improve that.

@philwebb philwebb closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2023
@philwebb philwebb added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 31, 2023
@philwebb
Copy link
Member

I just noticed you have javax.mail:javax.mail-api in the comment above that listed your dependencies, you'll need to switch to Jakarta versions.

@robozb
Copy link
Author

robozb commented Jul 31, 2023

You are my hero @philwebb :) Thank you so much!

@robozb
Copy link
Author

robozb commented Jul 31, 2023

I can't force to show the full exception list How could you do that? Thanks!

@philwebb
Copy link
Member

@robozb Ahh yes, it's a fun little debug trick. I added an exception breakpoint for ModelHandlerException. That stopped me at AppenderModelHandler line 75. I then added a watch expression of oops.printStackTrace() and that got me to the real cause in the console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants