embedded-redis icon indicating copy to clipboard operation
embedded-redis copied to clipboard

Minor: move slf4j dependency to test dependencies (unused in library).

Open doumdoum opened this issue 4 years ago • 6 comments

Hi, My very little contrib to your great work. Regards, /DV

doumdoum avatar Feb 20 '21 12:02 doumdoum

ping ;-)

doumdoum avatar Feb 24 '21 10:02 doumdoum

It's not a minor issue, it causes all tests to fail with Spring Boot 2.5.2.

Caused by: java.lang.IllegalStateException: Failed to load ApplicationContext
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132)
	at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124)
	at org.springframework.test.context.junit.jupiter.SpringExtension.getApplicationContext(SpringExtension.java:283)
	at org.springframework.test.context.junit.jupiter.SpringExtension.resolveParameter(SpringExtension.java:269)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.resolveParameter(ExecutableInvoker.java:216)
	... 77 more
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/me/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-simple/1.7.31/cf5df9007f6fb85f04728eec1dd96de73533fec7/slf4j-simple-1.7.31.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
	at org.springframework.util.Assert.instanceCheckFailed(Assert.java:702)

Any maintainer with a heartbeat still around?

asarkar avatar Jul 23 '21 06:07 asarkar

🙏 anyone there?

chrispwright avatar Sep 09 '21 15:09 chrispwright

Can confirm that causes the same issue as described by @asarkar in Spring Boot 2.3.2.

I found out a workarround in this korean website

Gradle compile ('it.ozimov:embedded-redis:0.7.3') { exclude group: "org.slf4j", module: "slf4j-simple" }

Kotlin Gradle testImplementation("it.ozimov:embedded-redis:0.7.3") { exclude(group = "org.slf4j", module = "slf4j-simple") }

EndermanAPM avatar Nov 30 '21 16:11 EndermanAPM

Up @robertotru and Happy New Year!

doumdoum avatar Jan 03 '22 08:01 doumdoum

Ah, glad to find out where this issue came from! For me it was not tied to upgrading Spring Boot though, but only happened after upgrading Gradle from 7.2 to 7.3.x The workaround with excluding the dependency worked for me.

It's not a minor issue, it causes all tests to fail with Spring Boot 2.5.2.

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/me/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-simple/1.7.31/cf5df9007f6fb85f04728eec1dd96de73533fec7/slf4j-simple-1.7.31.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
	at org.springframework.util.Assert.instanceCheckFailed(Assert.java:702)

alexkops avatar Jan 31 '22 14:01 alexkops