psangha | Posts: 7

LoggerFactory is not a Logback LoggerContext but Logback is on the classpath

0 votes

Hi all,

I am trying to implement SDK-11.33 to my current sprint boot application. But when I try to start the app I get the following issue: 

Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.SimpleLoggerFactory loaded from file:/Users/XYZ/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-simple/1.7.25/8dacf9514f0c707cbbcdd6fd699e8940d42fb54e/slf4j-simple-1.7.25.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.SimpleLoggerFactory

 

I am using spring boot and gradle.

 

Does anyone have any idea about how could I solve it?

 


Duo_Liang | Posts: 3776

Reply to: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath

1 votes

Hi psangha,

 

Sorry for the late reply! I managed to have a spring boot + gradle + OneSpan Sign Java SDK project works by disabling Logback globally and adding below snippet to the "build.gradle" file:

dependencies {
   ......

    // https://mvnrepository.com/artifact/com.silanis.esl/sdk
    compile group: 'com.silanis.esl', name: 'sdk', version: '11.33'
    
}

configurations {
    all*.exclude module : 'spring-boot-starter-logging'
}

 

The SDK built-in logger used "java.util.logging.Logger", not sure if this has a conflict with the Logback which Spring Boot autoconfigured with Tomcat, but I did encounter the same issue that with/without SDK in gradle caused the exception.

 

To enable the out of the box logger, you'd add a logging.properties file to your resource folder (an example has been attached), and set up a JVM property:
        System.setProperty("java.util.logging.config.file", "{path_to_the_logging_config_file}");
 

Duo

 


Attachments
logging.zip489 bytes

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off