Skip to content

Issue using along aside spring #20

@tesgoexperience

Description

@tesgoexperience

So my issue is a clash of logging dependencies when used alongside spring-boot 3.3.x.

> Task :bootRun FAILED
SLF4J: Class path contains multiple SLF4J providers.
SLF4J: Found provider [org.slf4j.nop.NOPServiceProvider@53bd815b]
SLF4J: Found provider [ch.qos.logback.classic.spi.LogbackServiceProvider@2401f4c3]
SLF4J: See https://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual provider is of type [org.slf4j.nop.NOPServiceProvider@53bd815b]
Exception in thread "main" 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.helpers.NOPLoggerFactory loaded from file:/home/cafe/.gradle/caches/modules-2/files-2.1/net.andrewcpu/elevenlabs-api/2.7.8/e62884e442b25afaeaba518f6d05885bce35745b/elevenlabs-api-2.7.8.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.helpers.NOPLoggerFactory
        at org.springframework.util.Assert.instanceCheckFailed(Assert.java:592)
        at org.springframework.util.Assert.isInstanceOf(Assert.java:511)
        at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:403)
        at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:128)
        at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:238)
        at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:220)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
        at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
        at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:75)
        at org.springframework.boot.SpringApplicationRunListeners.lambda$starting$0(SpringApplicationRunListeners.java:54)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
        at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:54)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352)
        at com.synthnarrator.api.ApiApplication.main(ApiApplication.java:19)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command '/usr/lib/jvm/java-21-openjdk/bin/java'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 712ms
4 actionable tasks: 1 executed, 3 up-to-date

I have tried excluding the logging dependencies from elevenlabs-api but that doesn't seem to work.

	implementation ('net.andrewcpu:elevenlabs-api:2.7.8'){
		exclude group: 'org.slf4j', module: 'slf4j-nop'
		exclude group: 'org.slf4j', module: 'slf4j-api'
		exclude group: 'org.slf4j', module: 'jul-to-slf4j'
		exclude group: 'org.apache.logging.log4j', module: 'log4j-api'
		exclude group: 'ch.qos.logback', module: 'logback-classic'
	}

I have even checked my dependency tree and there are no logging depencies being brought in.

+--- net.andrewcpu:elevenlabs-api:2.7.8
|    +--- com.fasterxml.jackson.core:jackson-databind:2.15.3 (*)
|    +--- com.fasterxml.jackson.core:jackson-annotations:2.15.3 (*)
|    +--- com.fasterxml.jackson.core:jackson-core:2.15.3 (*)
|    \--- org.apache.httpcomponents.client5:httpclient5:5.2.1 -> 5.3.1
|         +--- org.apache.httpcomponents.core5:httpcore5:5.2.4 -> 5.2.5
|         \--- org.apache.httpcomponents.core5:httpcore5-h2:5.2.4 -> 5.2.5
|              \--- org.apache.httpcomponents.core5:httpcore5:5.2.5

The only workingaround is to completely disable logging by removing logging dependencies.

configurations {
	all*.exclude group: 'ch.qos.logback', module: 'logback-classic'
}

Also, that's for the awesome API : ) and apologies if this isn't the space for this question.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions