如何从flink cassandra连接器中排除cassandra data stax驱动程序

yv5phkfx  于 2021-06-21  发布在  Flink
关注(0)|答案(1)|浏览(363)

我在cassandra sink相关代码中遇到运行时异常:

07/16/2018 17:09:48 Job execution switched to status FAILING.
java.lang.NoSuchMethodError: com.datastax.driver.core.BoundStatement.set(ILjava/lang/Object;Lorg/apache/flink/cassandra/shaded/com/google/common/reflect/TypeToken;)Lcom/datastax/driver/core/BoundStatement;

我还有另一个依赖项,它也使用datastax驱动程序和cassandra flink连接器。
我试图从flink cassandra连接器中排除datastax驱动程序,但没有按预期工作
我的sbt依赖项如下所示:

val datafeedsDeltaStreamDeps: Seq[ModuleID] = commonDependencies ++ flinkDeps ++ Seq(

    "org.apache.flink" %% "flink-connector-cassandra" % "1.4.1"  excludeAll ExclusionRule(organization = "com.datastax"), <<< I tried to exclude the data stax from the flink cassandra connector

    "com.dy.productfeed" %% "feedsinterface" % "0.4.0", << this also has a cassandra dependency in it
    CommonDependencies.statsdClient
  )

但我仍然看到Flink包裹下的“Cassandra”司机

9jyewag0

9jyewag01#

datastax库在flink-cassandra-connector.jar中有阴影,所以不能排除它。如果需要特定的datastax版本,可以使用以下命令针对该版本构建flink源代码:

directory: flink-connectors/flink-connector-cassandra
command: mvn package -Ddriver.version=3.1.4

相关问题