Exception in thread “streaming-start” java.lang.NoSuchMethodError: org.apache.kafka.clients.consumer

在尝试使用Spark Streaming连接Kafka 0.10时,遇到了java.lang.NoSuchMethodError异常。通过设置SPARK_KAFKA_VERSION环境变量为0.10,并调整依赖配置,最终解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Exception in thread “streaming-start” java.lang.NoSuchMethodError: org.apache.kafka.clients.consumer.KafkaConsumer.subscribe(Ljava/util/Collection;)V

Ask Question

When I submit the spark application, getting the below error:

Exception in thread "streaming-start" java.lang.NoSuchMethodError:

org.apache.kafka.clients.consumer.KafkaConsumer.subscribe(Ljava/util/Collection;)V

Went through the below URL: http://apache-spark-developers-list.1001551.n3.nabble.com/testing-the-kafka-0-10-connector-td17956.html

Set the below environment variable: SPARK_KAFKA_VERSION=0.10

Added the below dependency:

<dependency>
  <groupId>org.apache.spark</groupId>
  <artifactId>spark-streaming-kafka-0-10_2.11</artifactId>
  <version>2.1.0.cloudera1</version>
</dependency>

Added the below jar: spark-streaming-kafka-0-10-assembly_2.11.jar

Versions I'm using:

  • Spark-2.0.2
  • Scala-2.11
  • Kafka-0.10

A piece of code:

val CLASS_NAME = this.getClass
val log = org.apache.log4j.LogManager.getLogger(CLASS_NAME)

Your help is highly appreciated.

解决办法:export SPARK_KAFKA_VERSION=0.10

转自:https://stackoverflow.com/questions/45840824/exception-in-thread-streaming-start-java-lang-nosuchmethoderror-org-apache-ka

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值