0

Started a new project via this route:

sbt new playframework/play-scala-seed.g8

as indicated on this page: https://www.playframework.com/getting-started

It runs as expected.

Now I need to add parts of the AWS SDK like the following to the build.sbt file:

"com.amazonaws" % "aws-java-sdk-dynamodb" % "1.12.6"
"com.amazonaws" % "aws-java-sdk-s3" % "1.12.6"

Problem is that sbt run now stack traces as follows:

[error] com.fasterxml.jackson.databind.JsonMappingException: Scala module 2.11.4 requires Jackson Databind version >= 2.11.0 and < 2.12.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:835)
[error]     at akka.serialization.jackson.JacksonObjectMapperProvider$.$anonfun$configureObjectMapperModules$4(JacksonObjectMapperProvider.scala:242)
[error]     at akka.serialization.jackson.JacksonObjectMapperProvider$.$anonfun$configureObjectMapperModules$4$adapted(JacksonObjectMapperProvider.scala:241)
[error]     at scala.collection.immutable.List.foreach(List.scala:333)
[error]     at akka.serialization.jackson.JacksonObjectMapperProvider$.configureObjectMapperModules(JacksonObjectMapperProvider.scala:241)
[error]     at akka.serialization.jackson.JacksonObjectMapperProvider$.createObjectMapper(JacksonObjectMapperProvider.scala:265)
[error]     at akka.serialization.jackson.JacksonObjectMapperProvider.create(JacksonObjectMapperProvider.scala:359)
[error]     at akka.serialization.jackson.JacksonObjectMapperProvider.$anonfun$getOrCreate$1(JacksonObjectMapperProvider.scala:317)
[error]     at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
[error]     at akka.serialization.jackson.JacksonObjectMapperProvider.getOrCreate(JacksonObjectMapperProvider.scala:317)
[error]     at akka.serialization.jackson.JacksonJsonSerializer.<init>(JacksonSerializer.scala:141)
[error]     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[error]     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62
[error]     at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[error]     at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
[error]     at akka.actor.ReflectiveDynamicAccess.$anonfun$createInstanceFor$1(ReflectiveDynamicAccess.scala:40)
[error]     at scala.util.Try$.apply(Try.scala:210)
[error]     at akka.actor.ReflectiveDynamicAccess.createInstanceFor(ReflectiveDynamicAccess.scala:35)
[error]     at akka.actor.ReflectiveDynamicAccess.$anonfun$createInstanceFor$5(ReflectiveDynamicAccess.scala:48)
[error]     at scala.util.Success.flatMap(Try.scala:258)
[error]     at akka.actor.ReflectiveDynamicAccess.createInstanceFor(ReflectiveDynamicAccess.scala:47)
[error]     at akka.serialization.Serialization$$anonfun$serializerOf$1$$anonfun$applyOrElse$1.applyOrElse(Serialization.scala:396)
[error]     at akka.serialization.Serialization$$anonfun$serializerOf$1$$anonfun$applyOrElse$1.applyOrElse(Serialization.scala:392)
[error]     at scala.util.Failure.recoverWith(Try.scala:240)
[error]     at akka.serialization.Serialization$$anonfun$serializerOf$1.applyOrElse(Serialization.scala:392)
[error]     at akka.serialization.Serialization$$anonfun$serializerOf$1.applyOrElse(Serialization.scala:390)
[error]     at scala.util.Failure.recoverWith(Try.scala:240)
[error]     at akka.serialization.Serialization.serializerOf(Serialization.scala:390)
[error]     at akka.serialization.Serialization.$anonfun$serializers$2(Serialization.scala:424)
[error]     at scala.collection.Iterator$$anon$9.next(Iterator.scala:575)
[error]     at scala.collection.immutable.HashMapBuilder.addAll(HashMap.scala:2360)
[error]     at scala.collection.immutable.HashMap$.from(HashMap.scala:2182)
[error]     at scala.collection.immutable.HashMap$.from(HashMap.scala:2158)
[error]     at scala.collection.MapOps$WithFilter.map(Map.scala:348)
[error]     at akka.serialization.Serialization.<init>(Serialization.scala:424)
[error]     at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:18)
[error]     at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:14)
[error]     at akka.actor.ActorSystemImpl.registerExtension(ActorSystem.scala:1158)
[error]     at akka.actor.ActorSystemImpl.$anonfun$loadExtensions$1(ActorSystem.scala:1201)
[error]     at scala.collection.immutable.Vector.foreach(Vector.scala:1856)
[error]     at akka.actor.ActorSystemImpl.loadExtensions$1(ActorSystem.scala:1195)
[error]     at akka.actor.ActorSystemImpl.loadExtensions(ActorSystem.scala:1214)
[error]     at akka.actor.ActorSystemImpl.liftedTree2$1(ActorSystem.scala:1035)
[error]     at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:1022)
[error]     at akka.actor.ActorSystemImpl._start(ActorSystem.scala:1022)
[error]     at akka.actor.ActorSystemImpl.start(ActorSystem.scala:1045)
[error]     at akka.actor.ActorSystem$.apply(ActorSystem.scala:272)
[error]     at akka.actor.ActorSystem$.apply(ActorSystem.scala:316)
[error]     at akka.actor.ActorSystem$.apply(ActorSystem.scala:290)
[error]     at play.core.server.DevServerStart$.$anonfun$mainDev$1(DevServerStart.scala:291)
[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)

Now my question is not simply how do I fix this? It's more like how do I figure out how to fix this, aside from asking on StackOverflow...

So who's problem is this? (Aside from mine right now)

I've tried lowering the version of Scala a couple of notches as sometimes that helps but no joy here. I do not want to rewind major versions numbers backwards if it's not really not required.

Is there a better path to starting a project that side steps some of this?

Scala version: (build.sbt)

scalaVersion := "2.13.6" 

Play Version: (plugins.sbt)

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8")

SBT Version: (build.properties)

sbt.version=1.5.2

Java Version:

[info] welcome to sbt 1.5.2 (Amazon.com Inc. Java 11.0.9.1)

Sorry do not have enough clout to create the proper playframework tag playframework-2.8

I'm editing this question as StackOverflow asked if another question (Is there a way to stop Scala 2.12 breaking the Jackson object mapper?) helped solved the issue and then tagged this as a duplicate. It is NOT a duplicate as context matters and that question did not answer my problem it merely indicated a possible path to a solution. Moreover the accepted answer to that question actually FAILS in this context. Just trying to help other with the same issue not waste as much time as I did...

Techmag
  • 1,383
  • 13
  • 24
  • I actually found that and tried adding the entry in the hopes that it might help: but no joy. I thought I remembered it downloading and yet it didn't solve the problem so I commented it out however I just retried it now and it leads to this: ```ResolveException: Error downloading com.fasterxml.jackson.module:jackson-module-scala_2.13:2.8.8``` via this: ```https://repo1.maven.org/maven2/com/fasterxml/jackson/module/jackson-module-scala_2.13/2.8.8/jackson-module-scala_2.13-2.8.8.pom``` – Techmag Jun 17 '21 at 12:43
  • Checking https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-scala I see that it only goes to 2.12.3 and I do not know enough about what I don't know to do anything with that in this context. – Techmag Jun 17 '21 at 12:43
  • AH! This worked: ```"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.12.3"``` – Techmag Jun 17 '21 at 12:46
  • Shall I presume that since this latest version of the library is installed that other packages simply use that version and do not attempt to reference their dependencies? Does that means that ORDER of the libraryDependencies is significant? A quick test indicate that it is *not* important so presumably a complete scan occurs before any deeper dependency diving happens? – Techmag Jun 17 '21 at 12:54
  • 1
    I'd recommend to run `sbt dependencyBrowseTree` to identify where different Jackson versions come from and make sure you only have 2.11.x version (maybe by adding `dependencyOverrides` if needed) – Gaël J Jun 17 '21 at 13:20
  • That appears to be ```sbt``` then ```dependencyTree``` in the version that I'm using and yes I can see the evictions -- thank you! – Techmag Jun 17 '21 at 13:33

0 Answers0