MongoDB Reactive Streams 运行-Alpakka 的时间依赖性错误Mongo Connector ClassNotFoundException
MongoDB Reactive Streams run-time dependency error with Alpakka Mongo Connector ClassNotFoundException
我也在尝试集成 Alpakka Mongo Connector into an application that heavily relies on the Akka libraries for stream processing. The application utilizes Akka HTTP。
我在 运行 时遇到依赖性问题。特别是,当我尝试使用 Mongo 连接器提供的 MongoSink.insertOne
方法时,我得到了某种 Success/Failure 包装器的 NoClassDefFoundError
。完整的堆栈跟踪:
java.lang.NoClassDefFoundError: com/mongodb/reactivestreams/client/Success
at akka.stream.alpakka.mongodb.scaladsl.MongoFlow$.$anonfun$insertOne(MongoFlow.scala:44)
at akka.stream.impl.fusing.Map$$anon.onPush(Ops.scala:53)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:541)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:423)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:625)
at akka.stream.impl.fusing.ActorGraphInterpreter$SimpleBoundaryEvent.execute(ActorGraphInterpreter.scala:56)
at akka.stream.impl.fusing.ActorGraphInterpreter$SimpleBoundaryEvent.execute$(ActorGraphInterpreter.scala:52)
at akka.stream.impl.fusing.ActorGraphInterpreter$BatchingActorInputBoundary$OnNext.execute(ActorGraphInterpreter.scala:95)
at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:600)
at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:769)
at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive.applyOrElse(ActorGraphInterpreter.scala:784)
at akka.actor.Actor.aroundReceive(Actor.scala:537)
at akka.actor.Actor.aroundReceive$(Actor.scala:535)
at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:691)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:577)
at akka.actor.ActorCell.invoke(ActorCell.scala:547)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270)
at akka.dispatch.Mailbox.run(Mailbox.scala:231)
at akka.dispatch.Mailbox.exec(Mailbox.scala:243)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.ClassNotFoundException: com.mongodb.reactivestreams.client.Success
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 24 more
依赖关系:
val akkaHttpVersion = "10.2.1"
val akkaVersion = "2.6.10"
val scalaTestVersion = "3.2.0"
val scalaHtmlScraperVersion = "2.2.0"
val loggerVersion = "1.2.3"
val alpakkaMongoVersion = "2.0.2"
libraryDependencies ++= Seq(
"org.mongodb.scala" %% "mongo-scala-driver" % "4.1.1",
"com.typesafe.akka" %% "akka-stream-typed" % akkaVersion,
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion,
"com.lightbend.akka" %% "akka-stream-alpakka-mongodb" % "2.0.2",
"ch.qos.logback" % "logback-classic" % loggerVersion,
"org.scalactic" %% "scalactic" % scalaTestVersion,
"org.scalatest" %% "scalatest" % scalaTestVersion,
)
我也尝试添加 org.mongodb:mongodb-driver-reactivestreams:4.1.1
依赖项,但由于某些原因 com.mongodb.reactivestreams.client.Success
不是二进制文件的一部分。我也尝试了不同的版本。一些帮助肯定会受到赞赏。我正在使用 Scala 2.13.3
您的问题与 Mongo Reactive Streams 驱动程序有关。 Alpakka 使用的版本有点旧(2019 年 8 月 13 日)。请参阅“直接依赖项”部分的 Alpakka 文档:
org.mongodb mongodb-driver-reactivestreams 1.12.0
在那个罐子里你可以找到成功 class:
我也在尝试集成 Alpakka Mongo Connector into an application that heavily relies on the Akka libraries for stream processing. The application utilizes Akka HTTP。
我在 运行 时遇到依赖性问题。特别是,当我尝试使用 Mongo 连接器提供的 MongoSink.insertOne
方法时,我得到了某种 Success/Failure 包装器的 NoClassDefFoundError
。完整的堆栈跟踪:
java.lang.NoClassDefFoundError: com/mongodb/reactivestreams/client/Success
at akka.stream.alpakka.mongodb.scaladsl.MongoFlow$.$anonfun$insertOne(MongoFlow.scala:44)
at akka.stream.impl.fusing.Map$$anon.onPush(Ops.scala:53)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:541)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:423)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:625)
at akka.stream.impl.fusing.ActorGraphInterpreter$SimpleBoundaryEvent.execute(ActorGraphInterpreter.scala:56)
at akka.stream.impl.fusing.ActorGraphInterpreter$SimpleBoundaryEvent.execute$(ActorGraphInterpreter.scala:52)
at akka.stream.impl.fusing.ActorGraphInterpreter$BatchingActorInputBoundary$OnNext.execute(ActorGraphInterpreter.scala:95)
at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:600)
at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:769)
at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive.applyOrElse(ActorGraphInterpreter.scala:784)
at akka.actor.Actor.aroundReceive(Actor.scala:537)
at akka.actor.Actor.aroundReceive$(Actor.scala:535)
at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:691)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:577)
at akka.actor.ActorCell.invoke(ActorCell.scala:547)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270)
at akka.dispatch.Mailbox.run(Mailbox.scala:231)
at akka.dispatch.Mailbox.exec(Mailbox.scala:243)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.ClassNotFoundException: com.mongodb.reactivestreams.client.Success
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 24 more
依赖关系:
val akkaHttpVersion = "10.2.1"
val akkaVersion = "2.6.10"
val scalaTestVersion = "3.2.0"
val scalaHtmlScraperVersion = "2.2.0"
val loggerVersion = "1.2.3"
val alpakkaMongoVersion = "2.0.2"
libraryDependencies ++= Seq(
"org.mongodb.scala" %% "mongo-scala-driver" % "4.1.1",
"com.typesafe.akka" %% "akka-stream-typed" % akkaVersion,
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion,
"com.lightbend.akka" %% "akka-stream-alpakka-mongodb" % "2.0.2",
"ch.qos.logback" % "logback-classic" % loggerVersion,
"org.scalactic" %% "scalactic" % scalaTestVersion,
"org.scalatest" %% "scalatest" % scalaTestVersion,
)
我也尝试添加 org.mongodb:mongodb-driver-reactivestreams:4.1.1
依赖项,但由于某些原因 com.mongodb.reactivestreams.client.Success
不是二进制文件的一部分。我也尝试了不同的版本。一些帮助肯定会受到赞赏。我正在使用 Scala 2.13.3
您的问题与 Mongo Reactive Streams 驱动程序有关。 Alpakka 使用的版本有点旧(2019 年 8 月 13 日)。请参阅“直接依赖项”部分的 Alpakka 文档:
org.mongodb mongodb-driver-reactivestreams 1.12.0
在那个罐子里你可以找到成功 class: