Link to home
Create AccountLog in
Avatar of gp
gpFlag for United States of America

asked on

Exception in thread "main" java.lang.AbstractMethodError: ch/qos/logback/classic/spi/Configurator.configure(Lch/qos/logback/classic/LoggerContext;) Error

I recently upgraded from spring boot 2.7.6 to springboot 3.0.5 along with jdk 8 to jdk 17.I also upgraded maven from 3.3.9 to 3.9.1.

I used import jakarta.annotation.PostConstruct instead of
javax.annotation.PostConstruct 
in my code as i am using JDK 17 and spring boot 3.0.5 now to resolve errors in recognizing imports like 

Open in new window

javax.annotation.PostConstruct 

Open in new window

 .

Open in new window


I am able to clean successfully now.

I am able to install successfully now.


But when i start Intellij IDEA built in tomcat getting errors like below

Exception in thread "main" java.lang.AbstractMethodError: ch/qos/logback/classic/spi/Configurator.configure(Lch/qos/logback/classic/LoggerContext;)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:140)
   at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
   at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
   at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
   at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
   at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
   at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
   at org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:130)
   at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:91)
   at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
   at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
   at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:178)
   at com.xyz.TransactionMessageApplication.main(TransactionMessageApplication.java:21)


Process finished with exit code 1

Open in new window


I added below to POM.xml but did not fix this issue though

<dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>log4j-over-slf4j</artifactId>
         <version>1.7.30</version>
</dependency>


Please advise.

Avatar of Alex [***Alex140181***]
Alex [***Alex140181***]
Flag of Germany image

Have you tried "bridged mode"?!

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>jcl-over-slf4j</artifactId>
    <version>1.7.30</version>
</dependency>

Open in new window

https://www.baeldung.com/slf4j-with-log4j2-logback


Logback also differs regarding to Jakarta:

User generated image
https://logback.qos.ch/news.html

ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account