环境
spark:3.0.0
scala:2.12.10
kafka:2.12-2.2.2
描述
使用spark-streaming连接Kafka并读取数据,出现如下错误:
报错信息
Exception in thread "streaming-start" : org/apache/spark/kafka010/KafkaConfigUpdater
at .(:64)
at .(:91)
at .(:73)
at .(:258)
at .$anonfun$start$7(:55)
at .$anonfun$start$7$adapted(:55)
at (:941)
at $(:941)
at (:1429)
at $(:974)
at .$anonfun$tryLeaf$1(:53)
at .java8.JFunction0$mcV$(JFunction0$mcV$:23)
at $$anon$(:67)
at (:56)
at $(:50)
at $(:971)
at $(:153)
at $$(:149)
at $(:440)
at (:189)
at (:289)
at $(:1056)
at (:1692)
at (:157)
Caused by: : .
at (:382)
at (:424)
at $(:349)
at (:357)
... 24 more
解决方法
到Maven仓库下载:
:spark-streaming-kafka-0-10_2.12-3.0.
-token-provider-kafka-0-10_2.12-3.0.
将这两个jar包放到$SPARK_HOME/jars目录下;
3.创建目录$SPARK_HOME/jars将kafka安装目录中libs/* 复制到 $SPARK_HOME/jars/kafka中.
4.重新提交任务:
$SPARK_HOME/bin/spark-submit --driver-class-path \
$SPARK_HOME/jars*:$SPARK_HOME/jars/kafka/* \
--class youClass \