I’m not sure whether this is a bug in Akka or an issue in my code. I get this error when I upgrade my project to 2.6.6. This error has been added in PR #29112.
It seems to me that classes akka.serialization.jackson.JacksonJsonSerializer and akka.serialization.jackson.JacksonJsonSerializer are the same, so I guess the problem is in Akka?
In the meantime, I need my project to be usable with Akka 2.6.6. Is there something I can change in the config to fix the issue?
Thanks for reporting. We haven’t seen that in our tests or samples.
Have you defined any custom configuration in your application.conf for akka.actor.serializers or akka.actor.serialization-identifiers
You could run with the following configuration to see the full configuration that is used at runtime:
Not me, but maybe Play, which I’m using in the module that fails.
I’m trying to reproduce the issue locally, but for some reason it happened only in the CI so far… I don’t have time to investigate now, I’ll come back to it later.
I’m also getting this error, I’m using play 2.8.x, akka 2.6.6 and play-json-joda:
libraryDependencies += “com.typesafe.play” %% “play-json-joda” % “2.9.0”
Error in custom provider, java.lang.IllegalArgumentException: Serializer identifier [32] of [akka.serialization.jackson.JacksonJsonSerializer] is not unique. It is also used by [akka.serialization.jackson.JacksonJsonSerializer].
while locating play.api.libs.concurrent.ActorSystemProvider
while locating akka.actor.ActorSystem
for the 1st parameter of play.api.libs.Files$DefaultTemporaryFileReaper.(Files.scala:345)
at play.api.libs.Files$DefaultTemporaryFileReaper.class(Files.scala:345)
while locating play.api.libs.Files$DefaultTemporaryFileReaper
while locating play.api.libs.Files$TemporaryFileReaper
Caused by: java.lang.IllegalArgumentException: Serializer identifier [32] of [akka.serialization.jackson.JacksonJsonSerializer] is not unique. It is also used by [akka.serialization.jackson.JacksonJsonSerializer].
at akka.serialization.Serialization.$anonfun$serializerByIdentity$1(Serialization.scala:515)
at scala.collection.IterableOnceOps.foldLeft(IterableOnce.scala:638)
at scala.collection.IterableOnceOps.foldLeft$(IterableOnce.scala:634)
at scala.collection.AbstractIterable.foldLeft(Iterable.scala:920)
at akka.serialization.Serialization.(Serialization.scala:508)
at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:18)
at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:14)
at akka.actor.ActorSystemImpl.registerExtension(ActorSystem.scala:1145)
at akka.actor.ActorSystemImpl.$anonfun$loadExtensions$1(ActorSystem.scala:1188)
at scala.collection.immutable.Vector.foreach(Vector.scala:1794)
at akka.actor.ActorSystemImpl.loadExtensions$1(ActorSystem.scala:1182)
at akka.actor.ActorSystemImpl.loadExtensions(ActorSystem.scala:1201)
at akka.actor.ActorSystemImpl.liftedTree2$1(ActorSystem.scala:1026)
at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:1013)
at akka.actor.ActorSystemImpl._start(ActorSystem.scala:1013)
at akka.actor.ActorSystemImpl.start(ActorSystem.scala:1036)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:272)
at play.api.libs.concurrent.ActorSystemProvider$.start(Akka.scala:233)
at play.api.libs.concurrent.ActorSystemProvider.get$lzycompute(Akka.scala:127)
at play.api.libs.concurrent.ActorSystemProvider.get(Akka.scala:127)
at play.api.libs.concurrent.ActorSystemProvider.get(Akka.scala:125)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:85)
at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:77)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:59)
at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:61)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:168)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:62)
at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:213)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:184)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:111)
at com.google.inject.Guice.createInjector(Guice.java:87)
at com.google.inject.Guice.createInjector(Guice.java:78)
at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:200)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:155)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:54)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:30)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)
Yes it’s set to “INFO”, but i think it crashes before printing configs. It starts 24 logger threads and then produces 24 error messages. Here are the deps:
I’m using play 2.8.2
I’ve created a new project and modified build.sbt:
name := """play-scala-seed"""
organization := "com.example"
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.13.3"
libraryDependencies += guice
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test
val akkaVersion = "2.6.6"
libraryDependencies += "com.typesafe.akka" %% "akka-actor-typed" % akkaVersion
libraryDependencies += "com.typesafe.akka" %% "akka-stream-typed" % akkaVersion
libraryDependencies += "com.typesafe.akka" %% "akka-protobuf-v3" % akkaVersion
// Adds additional packages into Twirl
//TwirlKeys.templateImports += "com.example.controllers._"
// Adds additional packages into conf/routes
// play.sbt.routes.RoutesKeys.routesImport += "com.example.binders._"
Then running sbt run produces this error:
[info] welcome to sbt 1.3.13 (N/A Java 13.0.2)
[info] loading global plugins from /Users/petr/.sbt/1.0/plugins
[info] loading settings for project play-scala-seed-build from plugins.sbt ...
[info] loading project definition from /Users/petr/Projects/temp/play-scala-seed/project
[info] loading settings for project root from build.sbt ...
[info] set current project to play-scala-seed (in build file:/Users/petr/Projects/temp/play-scala-seed/)
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
--- (Running the application, auto-reloading is enabled) ---
[error] java.lang.IllegalArgumentException: Serializer identifier [32] of [akka.serialization.jackson.JacksonJsonSerializer] is not unique. It is also used by [akka.serialization.jackson.JacksonJsonSerializer].
[error] at akka.serialization.Serialization.$anonfun$serializerByIdentity$1(Serialization.scala:515)
[error] at scala.collection.IterableOnceOps.foldLeft(IterableOnce.scala:638)
[error] at scala.collection.IterableOnceOps.foldLeft$(IterableOnce.scala:634)
[error] at scala.collection.AbstractIterable.foldLeft(Iterable.scala:920)
[error] at akka.serialization.Serialization.<init>(Serialization.scala:508)
[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:1145)
[error] at akka.actor.ActorSystemImpl.$anonfun$loadExtensions$1(ActorSystem.scala:1188)
[error] at scala.collection.immutable.Vector.foreach(Vector.scala:1856)
[error] at akka.actor.ActorSystemImpl.loadExtensions$1(ActorSystem.scala:1182)
[error] at akka.actor.ActorSystemImpl.loadExtensions(ActorSystem.scala:1201)
[error] at akka.actor.ActorSystemImpl.liftedTree2$1(ActorSystem.scala:1026)
[error] at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:1013)
[error] at akka.actor.ActorSystemImpl._start(ActorSystem.scala:1013)
[error] at akka.actor.ActorSystemImpl.start(ActorSystem.scala:1036)
[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:248)
[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:567)
[error] at play.runsupport.Reloader$.startDevMode(Reloader.scala:306)
[error] at play.sbt.run.PlayRun$.devModeServer$lzycompute$1(PlayRun.scala:98)
[error] at play.sbt.run.PlayRun$.devModeServer$1(PlayRun.scala:81)
[error] at play.sbt.run.PlayRun$.$anonfun$playRunTask$3(PlayRun.scala:105)
[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
[error] Total time: 4 s, completed Jul 3, 2020, 11:21:17 AM
I see you are experiencing the error when executing the project in DevMode (sbt run). I suspect the versions mixup is causing Akka’s Serialization code to see both akka.serialization.jackson.JacksonJsonSerializer in your classpath.
Put another way, I suspect in dev mode Play uses some Akka artifacts in the 2.6.5 version and then some Akka artifacts in the 2.6.6 version.
I would suggest you review the complete list of dependencies your project is pulling and try to override all the existing akka artifacts to make sure all of them are pulled in the 2.6.6 version. This is recommended anyway since Akka already does such verifications but I’m guessing the serialization issue happens before the Akka’s version verification (?)
I haven’t dug into the details, so if you can provide a reproducer and create an issue in playframework there’ll be more info to continue investigating.