嵌入的Cassandra与Spark和DataStax驱动程序错误



我们正在为我们的项目使用以下依赖项。

val cassandraConnector = "com.datastax.spark" %% "spark-cassandra-connector" % "2.0.0"
val sparkSql = "org.apache.spark" % "spark-sql_2.11" % "2.2.0"
val phantomDsl = "com.outworkers" % "phantom-dsl_2.11" % "2.15.5"
val cassandraUnit = "org.cassandraunit" % "cassandra-unit" % "3.3.0.2" % "test"

使用命令 sbt 编译测试运行测试用例时。我们收到以下错误:-

[error] java.lang.IncompatibleClassChangeError: Class com.datastax.driver.core.DefaultResultSetFuture does not implement the requested interface com.google.common.util.concurrent.ListenableFuture
[error]     at com.google.common.util.concurrent.Futures.addCallback(Futures.java:1776)
[error]     at com.outworkers.phantom.builder.query.execution.PromiseInterface$$anon$1.fromGuava(ExactlyOncePromise.scala:56)
[error]     at com.outworkers.phantom.builder.query.execution.PromiseInterface$$anon$1.fromGuava(ExactlyOncePromise.scala:63)
[error]     at com.outworkers.phantom.builder.query.execution.GuavaAdapter$class.fromGuava(ExecutableStatements.scala:44)
[error]     at com.outworkers.phantom.builder.query.execution.PromiseInterface$$anon$1.fromGuava(ExactlyOncePromise.scala:39)
[error]     at com.outworkers.phantom.builder.query.execution.ExecutableStatements$$anonfun$future$1.apply(ExecutableStatements.scala:112)
[error]     at com.outworkers.phantom.builder.query.execution.ExecutableStatements$$anonfun$future$1.apply(ExecutableStatements.scala:110)
[error]     at scala.collection.immutable.List.foreach(List.scala:381)
[error]     at com.outworkers.phantom.builder.query.execution.ExecutableStatements.future(ExecutableStatements.scala:110)
[error]     at com.outworkers.phantom.ops.DbOps.truncateAsync(DbOps.scala:104)
[error]     at com.outworkers.phantom.ops.DbOps.truncate(DbOps.scala:94)
[error]     at com.knoldus.cassandra.CassandraDatabaseCluster$class.afterAll(CassandraDatabaseCluster.scala:29)
[error]     at com.knoldus.model.PredicateHashingSuite.afterAll(PredicateHashingSuite.scala:7)
[error]     at org.scalatest.BeforeAndAfterAll$$anonfun$1.apply$mcV$sp(BeforeAndAfterAll.scala:225)
[error]     at org.scalatest.Status$$anonfun$withAfterEffect$1.apply(Status.scala:379)
[error]     at org.scalatest.Status$$anonfun$withAfterEffect$1.apply(Status.scala:375)
[error]     at org.scalatest.FailedStatus$.whenCompleted(Status.scala:497)
[error]     at org.scalatest.Status$class.withAfterEffect(Status.scala:375)
[error]     at org.scalatest.FailedStatus$.withAfterEffect(Status.scala:469)
[error]     at org.scalatest.BeforeAndAfterAll$class.run(BeforeAndAfterAll.scala:223)
[error]     at com.knoldus.model.PredicateHashingSuite.run(PredicateHashingSuite.scala:7)
[error]     at org.scalatest.tools.Framework.org$scalatest$tools$Framework$$runSuite(Framework.scala:314)
[error]     at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:480)
[error]     at sbt.TestRunner.runTest$1(TestFramework.scala:102)
[error]     at sbt.TestRunner.run(TestFramework.scala:113)
[error]     at sbt.TestFramework$$anon$2$$anonfun$$lessinit$greater$1.$anonfun$apply$1(TestFramework.scala:258)
[error]     at sbt.TestFramework$.sbt$TestFramework$$withContextLoader(TestFramework.scala:229)
[error]     at sbt.TestFramework$$anon$2$$anonfun$$lessinit$greater$1.apply(TestFramework.scala:258)
[error]     at sbt.TestFramework$$anon$2$$anonfun$$lessinit$greater$1.apply(TestFramework.scala:258)
[error]     at sbt.TestFunction.apply(TestFramework.scala:267)
[error]     at sbt.Tests$.$anonfun$toTask$1(Tests.scala:276)
[error]     at sbt.std.Transform$$anon$3.$anonfun$apply$2(System.scala:44)
[error]     at sbt.std.Transform$$anon$4.work(System.scala:64)
[error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:257)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]     at sbt.Execute.work(Execute.scala:266)
[error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:257)
[error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167)
[error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:32)
[error]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]     at java.lang.Thread.run(Thread.java:748)

依赖性有问题吗?

我们如何摆脱这个错误?

谢谢

这真的很有趣,但是它与幻影无关,而是与番石榴库依赖项有关,该依赖项最终以某种方式与类路径上的内容发生冲突。

简而言之,基本上问题来自二进制不兼容/排除,因此 Spark 或类路径中的其他内容会覆盖 phantom 中的 Guava 版本。

如果您打印出驱逐,我可以进一步帮助您。

我们还提供phantom-sbt作为Cassandra的集成SBT插件,我怀疑这是这里的根本原因,以及通过SBT(仅限专业功能(的Docker集成。也许为 phantom 提交一个 GitHub 问题,一旦我们知道哪些版本冲突,我们就可以更轻松地跟进。

相关内容

  • 没有找到相关文章

最新更新