Akka java.lang.NoClassDefFoundError: akka/serialization/Serializers$

陆星文
2023-12-01

[ERROR] [SECURITY][08/18/2022 23:09:16.361] [client-akka.remote.default-remote-dispatcher-6] [akka.actor.ActorSystemImpl(client)] Uncaught error from thread [client-akka.remote.default-remote-dispatcher-6] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled
Uncaught error from thread [client-akka.remote.default-remote-dispatcher-6] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[client]
java.lang.NoClassDefFoundError: akka/serialization/Serializers$
    at akka.remote.serialization.MessageContainerSerializer.serializeSelection(MessageContainerSerializer.scala:40)
    at akka.remote.serialization.MessageContainerSerializer.toBinary(MessageContainerSerializer.scala:25)
    at akka.remote.MessageSerializer$.serialize(MessageSerializer.scala:52)
    at akka.remote.EndpointWriter$$anonfun$serializeMessage$1.apply(Endpoint.scala:906)
    at akka.remote.EndpointWriter$$anonfun$serializeMessage$1.apply(Endpoint.scala:906)
    at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
    at akka.remote.EndpointWriter.serializeMessage(Endpoint.scala:905)
    at akka.remote.EndpointWriter.writeSend(Endpoint.scala:793)
    at akka.remote.EndpointWriter.delegate$1(Endpoint.scala:682)
    at akka.remote.EndpointWriter.writeLoop$1(Endpoint.scala:693)
    at akka.remote.EndpointWriter.sendBufferedMessages(Endpoint.scala:706)
    at akka.remote.EndpointWriter.becomeWritingOrSendBufferedMessages(Endpoint.scala:652)
    at akka.remote.EndpointWriter$$anonfun$initializing$1.applyOrElse(Endpoint.scala:626)
    at akka.actor.Actor$class.aroundReceive(Actor.scala:497)
    at akka.remote.EndpointActor.aroundReceive(Endpoint.scala:458)
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
    at akka.actor.ActorCell.invoke(ActorCell.scala:495)
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
    at akka.dispatch.Mailbox.run(Mailbox.scala:224)
    at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.ClassNotFoundException: akka.serialization.Serializers$
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 24 more

关于上面的问题,可能是pom.xml的依赖没有弄好,主要看下面的版本号他们是不一致的才引发了上面的链接问题

<!-- actor -->
<dependency>
    <groupId>com.typesafe.akka</groupId>
    <artifactId>akka-actor_2.11</artifactId>
    <version>2.4.17</version>
</dependency>

<!-- actor并发-->
<dependency>
    <groupId>com.typesafe.akka</groupId>
    <artifactId>akka-remote_2.11</artifactId>
    <version>2.5.17</version>
</dependency>

解决方法:将版本号修改成一样的就好了(我也是第一次接触akka,没注意这些细节)

<!-- actor -->
<dependency>
    <groupId>com.typesafe.akka</groupId>
    <artifactId>akka-actor_2.11</artifactId>
    <version>2.4.17</version>
</dependency>

<!-- actor并发-->
<dependency>
    <groupId>com.typesafe.akka</groupId>
    <artifactId>akka-remote_2.11</artifactId>
    <version>2.4.17</version>
</dependency>

希望能帮助到和我一样的人吧

 类似资料:

相关阅读

相关文章

相关问答