question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Play 2.8.18 won't start due to old SLF4J bindings

See original GitHub issue

Play Version

Play 2.8.18

API

Scala 2.13.10

Operating System

Linux xxx-precision 6.0.0-1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.0.2-1 (2022-10-16) x86_64 GNU/Linux

JDK

openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment (build 11.0.17+8-post-Debian-2)
OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Debian-2, mixed mode, sharing)

Library Dependencies

Expected Behavior

sbt run should start Play server

Actual Behavior

sbt crashes with following messages :

SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J: Ignoring binding found at [jar:file:/home/xxx/.cache/coursier/v1/https/repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.2.11/logback-classic-1.2.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.
[error] java.lang.ClassCastException: class org.slf4j.helpers.NOPLoggerFactory cannot be cast to class ch.qos.logback.classic.LoggerContext (org.slf4j.helpers.NOPLoggerFactory and ch.qos.logback.classic.LoggerContext are in unnamed module of loader play.runsupport.NamedURLClassLoader @59c6e2f2)
[error] 	at play.api.libs.logback.LogbackLoggerConfigurator.configure(LogbackLoggerConfigurator.scala:91)
[error] 	at play.api.libs.logback.LogbackLoggerConfigurator.init(LogbackLoggerConfigurator.scala:31)
[error] 	at play.core.server.DevServerStart$.$anonfun$mainDev$1(DevServerStart.scala:106)
[error] 	at play.utils.Threads$.withContextClassLoader(Threads.scala:22)
[error] 	at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:76)
[error] 	at play.core.server.DevServerStart$.mainDevHttpMode(DevServerStart.scala:50)
[error] 	at play.core.server.DevServerStart.mainDevHttpMode(DevServerStart.scala)
[error] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[error] 	at play.runsupport.Reloader$.startDevMode(Reloader.scala:306)
[error] 	at play.sbt.run.PlayRun$.devModeServer$lzycompute$1(PlayRun.scala:100)
[error] 	at play.sbt.run.PlayRun$.devModeServer$1(PlayRun.scala:83)
[error] 	at play.sbt.run.PlayRun$.$anonfun$playRunTask$3(PlayRun.scala:107)
[error] 	at play.sbt.run.PlayRun$.$anonfun$playRunTask$3$adapted(PlayRun.scala:67)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] stack trace is suppressed; run last Compile / run for the full output
[error] (Compile / run) java.lang.reflect.InvocationTargetException

Bug probably due to outdated logback-classic dependency in Play 2.8.18. From dependencyTree output:

[info]   +-com.typesafe.play:play-logback_2.13:2.8.18 [S]
[info]   | +-ch.qos.logback:logback-classic:1.2.11
[info]   | | +-ch.qos.logback:logback-core:1.2.11
[info]   | | +-org.slf4j:slf4j-api:1.7.32 (evicted by: 2.0.1)
[info]   | | +-org.slf4j:slf4j-api:2.0.1

Adding a more recent logback dependency apparently solves the problem: libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.4.4",

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mkurzcommented, Nov 8, 2022

Do you recommend doing that for this specific version of Play or do you see any future impacts of this update ?

@pasindusenevirathne I think you want to use logback-classic version 1.3.4 (because 1.4.x switched to jakarta.* namespace), which IMHO should be fine. We even thinking about to upgrade to logback-classic 1.3.x in the next Play 2.8.x release, see #11501

1reaction
mkurzcommented, Oct 25, 2022

@felipebonezi I guess you meant #11501? I linked them so if we merge it will close this issue 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · playframework/playframework - GitHub
On Play 2.8.18, heap memory issues arises on server ... Play project doesn't work with sbt 1.7.3 ... Play 2.8.18 won't start due...
Read more >
Play 2.7 Migration Guide - Documentation
There is currently no way to configure the cache per request. ... causing Denial-of-Service, body parsing and form binding must honour the play.http.parser....
Read more >
Multiple SLF4J bindings with Play 2.3.8 - Stack Overflow
I use Play Framework 2.3.8 (for Java) with Scala 2.11. I get this warning: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found...
Read more >
SLF4J Warning: Class Path Contains Multiple SLF4J Bindings
This is because when a library declares a compile-time dependency on an SLF4J binding, it imposes that binding on the end user. Obviously,...
Read more >
Untitled
... 0install-2.6-no-tests.patch 0install-2.9.1-lib64.patch 0install.spec ... TurboGears-old-turbokid.patch TurboGears.spec porting-1.0-1.1.txt ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found