Getting the below error while migration play to 2.8.8

Getting the below issue in play framework 2.8.x upgrade

java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
[error] at play.api.libs.logback.LogbackLoggerConfigurator.configure(LogbackLoggerConfigurator.scala:92)
[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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.lang.reflect.Method.invoke(Method.java:498)
[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

You need to check the jars that you are adding to your build. You should only have 1 slf4j implementation and the stacktrace indicates that you have 2 - logback and slf4j-log4j (probably slf4j-log4j12).

1 Like