Serialization error after disabling java serialization

I tried disabling Java serialization with below config. My cluster remoting is through netty tcp

#Disable Java serialization
akka.actor.allow-java-serialization = off
akka.actor.enable-additional-serialization-bindings = on

#enable this in local.conf (non production)
akka.actor.serialize-messages = on
akka.actor.serialize-creators = on

I am getting below stacktrace, I don’t want to put Java serialization back, any help appreciated.

[INFO] [10/27/2019 11:35:12.052] [main] [akka.cluster.Cluster(akka://test-akka-cluster)] Cluster Node [akka.tcp://test-akka-cluster@127.0.0.1:2551] - Starting up, Akka version [2.5.26] ...
[ERROR] [10/27/2019 11:35:12.069] [test-akka-cluster-akka.actor.default-dispatcher-2] [akka://test-akka-cluster/system/cluster] pre-creation serialization check failed at [akka://test-akka-cluster/system/cluster/core]
java.lang.IllegalArgumentException: pre-creation serialization check failed at [akka://test-akka-cluster/system/cluster/core]
	at akka.actor.dungeon.Children.makeChild(Children.scala:278)
	at akka.actor.dungeon.Children.actorOf(Children.scala:47)
	at akka.actor.dungeon.Children.actorOf$(Children.scala:46)
	at akka.actor.ActorCell.actorOf(ActorCell.scala:447)
	at akka.cluster.ClusterDaemon.createChildren(ClusterDaemon.scala:224)
	at akka.cluster.ClusterDaemon$$anonfun$receive$1.applyOrElse(ClusterDaemon.scala:233)
	at akka.actor.Actor.aroundReceive(Actor.scala:539)
	at akka.actor.Actor.aroundReceive$(Actor.scala:537)
	at akka.cluster.ClusterDaemon.aroundReceive(ClusterDaemon.scala:186)
	at akka.actor.ActorCell.receiveMessage(ActorCell.scala:612)
	at akka.actor.ActorCell.invoke(ActorCell.scala:581)
	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:268)
	at akka.dispatch.Mailbox.run(Mailbox.scala:229)
	at akka.dispatch.Mailbox.exec(Mailbox.scala:241)
	at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
	at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
	at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
	at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.io.NotSerializableException: No configured serialization-bindings for class [akka.cluster.JoinConfigCompatChecker$$anon$1]
	at akka.serialization.Serialization.serializerFor(Serialization.scala:332)
	at akka.serialization.Serialization.findSerializerFor(Serialization.scala:307)
	at akka.actor.dungeon.Children.$anonfun$makeChild$1(Children.scala:271)
	at akka.actor.dungeon.Children.$anonfun$makeChild$1$adapted(Children.scala:267)
	at scala.collection.LinearSeqOptimized.forall(LinearSeqOptimized.scala:85)
	at scala.collection.LinearSeqOptimized.forall$(LinearSeqOptimized.scala:82)
	at scala.collection.immutable.List.forall(List.scala:89)
	at akka.actor.dungeon.Children.makeChild(Children.scala:267)

I’d recommend disabling akka.actor.serialize-creators = on, what it does is try to serialize all props used to start actors, but not all props were meant to be remotely deployed so props will never be sent to other nodes, in this case it is an internal cluster actor which will never be remotely deployed failing the serialization check.

akka.actor.serialize-messages = on has the same problem but for messages, so can also be problematic in that it will require that any message sent, even completely internal messages that are never sent across network must have a serializer or be marked with akka.actor.NoSerializationVerificationNeeded when that is enabled.

Thank you! Probably this has to be updated in the documentation

https://doc.akka.io/docs/akka/current/serialization.html

According to doc, it is ok to enable below properties in local for debugging
akka.actor.serialize-messages = on
akka.actor.serialize-creators = on

Yes that could probably be clarified. A test that starts cluster can probably not be considered local, so just running your local tests without cluster (akka.provider = local) should let you enable those test settings without problems.

As a side note, in the long run we’ll probably want to provide a serialization testkit for verifying messages more explicitly. Moving forward with the typed APIs in 2.6 there is no way to do remote deploy, so that we will probably leave as it is for the “classic” actor API.

1 Like