auth0 / jwks-rsa-java

MIT License
196 stars 73 forks source link

com.fasterxml.jackson.databind.JsonMappingException: Scala module 2.14.3 requires Jackson Databind version >= 2.14.0 and < 2.15.0 - Found jackson-databind version 2.15.0 #192

Open minnieshi opened 9 months ago

minnieshi commented 9 months ago

Checklist

Description

using below jwks-rsa 0.22.1, scala 2.13.12

scalaVersion := "2.13.12"

libraryDependencies ++= Seq(
  "com.github.jwt-scala" %% "jwt-play" % "10.0.0",
  "com.github.jwt-scala" %% "jwt-core" % "10.0.0",
  "com.auth0"             % "jwks-rsa" % "0.22.1"
)

and play framework 3.0.1

  addSbtPlugin("org.playframework"        % "sbt-plugin"          % "3.0.1")

when run the application, sbt run

it has exceptions like beow

[error] com.fasterxml.jackson.databind.JsonMappingException: Scala module 2.14.3 requires Jackson Databind version >= 2.14.0 and < 2.15.0 - Found jackson-databind version 2.15.0

see more details:

[info] welcome to sbt 1.9.8 (Amazon.com Inc. Java 17.0.6) [info] loading settings for project shimba-play-framework-build from plugins.sbt ... [info] loading project definition from /Users/min.shi/code/shimba-play-framework/project [info] loading settings for project root from build.sbt ... [info] __ __ [info] \ \ ____ / /____ _ __ __ [info] \ \ / __ \ / // __ `// / / / [info] / / / /_/ // // /_/ // /_/ / [info] /_/ / .___//_/ \__,_/ \__, / [info] /_/ /____/ [info] [info] Version 3.0.1 running Java 17.0.6 [info] [info] Play is run entirely by the community. Please consider contributing and/or donating: [info] https://www.playframework.com/sponsors [info] --- (Running the application, auto-reloading is enabled) --- [error] com.fasterxml.jackson.databind.JsonMappingException: Scala module 2.14.3 requires Jackson Databind version >= 2.14.0 and < 2.15.0 - Found jackson-databind version 2.15.0 [error] at com.fasterxml.jackson.module.scala.JacksonModule.setupModule(JacksonModule.scala:61) [error] at com.fasterxml.jackson.module.scala.JacksonModule.setupModule$(JacksonModule.scala:46) [error] at com.fasterxml.jackson.module.scala.DefaultScalaModule.setupModule(DefaultScalaModule.scala:17) [error] at com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:879) [error] at org.apache.pekko.serialization.jackson.JacksonObjectMapperProvider$.$anonfun$configureObjectMapperModules$4(JacksonObjectMapperProvider.scala:252) [error] at org.apache.pekko.serialization.jackson.JacksonObjectMapperProvider$.$anonfun$configureObjectMapperModules$4$adapted(JacksonObjectMapperProvider.scala:251) [error] at scala.collection.immutable.List.foreach(List.scala:333) [error] at org.apache.pekko.serialization.jackson.JacksonObjectMapperProvider$.configureObjectMapperModules(JacksonObjectMapperProvider.scala:251) [error] at org.apache.pekko.serialization.jackson.JacksonObjectMapperProvider$.createObjectMapper(JacksonObjectMapperProvider.scala:275) [error] at org.apache.pekko.serialization.jackson.JacksonObjectMapperProvider.create(JacksonObjectMapperProvider.scala:369) [error] at org.apache.pekko.serialization.jackson.JacksonObjectMapperProvider.$anonfun$getOrCreate$1(JacksonObjectMapperProvider.scala:327) [error] at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) [error] at org.apache.pekko.serialization.jackson.JacksonObjectMapperProvider.getOrCreate(JacksonObjectMapperProvider.scala:327) [error] at org.apache.pekko.serialization.jackson.JacksonJsonSerializer.(JacksonSerializer.scala:151) [error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) [error] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [error] at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) [error] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) [error] at org.apache.pekko.actor.ReflectiveDynamicAccess.$anonfun$createInstanceFor$1(ReflectiveDynamicAccess.scala:50) [error] at scala.util.Try$.apply(Try.scala:210) [error] at org.apache.pekko.actor.ReflectiveDynamicAccess.createInstanceFor(ReflectiveDynamicAccess.scala:45) [error] at org.apache.pekko.actor.ReflectiveDynamicAccess.$anonfun$createInstanceFor$5(ReflectiveDynamicAccess.scala:58) [error] at scala.util.Success.flatMap(Try.scala:258) [error] at org.apache.pekko.actor.ReflectiveDynamicAccess.createInstanceFor(ReflectiveDynamicAccess.scala:57) [error] at org.apache.pekko.serialization.Serialization$$anonfun$serializerOf$1$$anonfun$applyOrElse$1.applyOrElse(Serialization.scala:409) [error] at org.apache.pekko.serialization.Serialization$$anonfun$serializerOf$1$$anonfun$applyOrElse$1.applyOrElse(Serialization.scala:405) [error] at scala.util.Failure.recoverWith(Try.scala:240) [error] at org.apache.pekko.serialization.Serialization$$anonfun$serializerOf$1.applyOrElse(Serialization.scala:405) [error] at org.apache.pekko.serialization.Serialization$$anonfun$serializerOf$1.applyOrElse(Serialization.scala:403) [error] at scala.util.Failure.recoverWith(Try.scala:240) [error] at org.apache.pekko.serialization.Serialization.serializerOf(Serialization.scala:403) [error] at org.apache.pekko.serialization.Serialization.$anonfun$serializers$2(Serialization.scala:437) [error] at scala.collection.Iterator$$anon$9.next(Iterator.scala:584) [error] at scala.collection.immutable.HashMapBuilder.addAll(HashMap.scala:2406) [error] at scala.collection.immutable.HashMap$.from(HashMap.scala:2218) [error] at scala.collection.immutable.HashMap$.from(HashMap.scala:2194) [error] at scala.collection.MapOps$WithFilter.map(Map.scala:381) [error] at org.apache.pekko.serialization.Serialization.(Serialization.scala:437) [error] at org.apache.pekko.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:28) [error] at org.apache.pekko.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:24) [error] at org.apache.pekko.actor.ActorSystemImpl.registerExtension(ActorSystem.scala:1177) [error] at org.apache.pekko.actor.ActorSystemImpl.$anonfun$loadExtensions$1(ActorSystem.scala:1220) [error] at scala.collection.immutable.Vector.foreach(Vector.scala:2124) [error] at org.apache.pekko.actor.ActorSystemImpl.loadExtensions$1(ActorSystem.scala:1214) [error] at org.apache.pekko.actor.ActorSystemImpl.loadExtensions(ActorSystem.scala:1233) [error] at org.apache.pekko.actor.ActorSystemImpl.liftedTree2$1(ActorSystem.scala:1054) [error] at org.apache.pekko.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:1041) [error] at org.apache.pekko.actor.ActorSystemImpl._start(ActorSystem.scala:1040) [error] at org.apache.pekko.actor.ActorSystemImpl.start(ActorSystem.scala:1064) [error] at org.apache.pekko.actor.ActorSystem$.apply(ActorSystem.scala:282) [error] at org.apache.pekko.actor.ActorSystem$.apply(ActorSystem.scala:326) [error] at org.apache.pekko.actor.ActorSystem$.apply(ActorSystem.scala:300) [error] at play.core.server.DevServerStart$.mkServerActorSystem(DevServerStart.scala:90) [error] at play.core.server.DevServerStart$.$anonfun$mainDev$1(DevServerStart.scala:80) [error] at play.core.server.DevServerStart.$anonfun$mainDev$2(DevServerStart.scala:308) [error] at play.utils.Threads$.withContextClassLoader(Threads.scala:22) [error] at play.core.server.DevServerStart.mainDev(DevServerStart.scala:107) [error] at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:80) [error] at play.core.server.DevServerStart$.mainDevHttpMode(DevServerStart.scala:55) [error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) [error] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [error] at java.base/java.lang.reflect.Method.invoke(Method.java:568) [error] at play.runsupport.Reloader$.startDevMode(Reloader.scala:314) [error] stack trace is suppressed; run last Compile / run for the full output [error] (Compile / run) com.fasterxml.jackson.databind.JsonMappingException: Scala module 2.14.3 requires Jackson Databind version >= 2.14.0 and < 2.15.0 - Found jackson-databind version 2.15.0 [error] Total time: 1 s, completed 11 Feb 2024, 17.43.12

I had to add below as work around:

dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-databind" % "2.14.2"

inspired from this issue: https://github.com/jwt-scala/jwt-scala/issues/403

Qs:

Reproduction

see description add the dependency and playframework, run the application it hsa the run time error

Additional context

No response

jwks-rsa version

0.22.1

Java version

17.0.6

wsargent commented 5 months ago

It's saying that for https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-scala_3/2.14.3 -- the jackson-databind dependency should also be 2.14.3.

For Play, it's probably better to upgrade everything to latest Jackson:

"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.17.1",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.17.1",