• Spark-submit 流处理报错:NoClassDefFoundError: org/apache/kafka/clients/consumer/Consumer


    错误内容如下

    20/03/13 15:21:20 ERROR ApplicationMaster: User class threw exception: java.lang.NoClassDefFoundError: org/apache/kafka/clients/consumer/Consumer
    java.lang.NoClassDefFoundError: org/apache/kafka/clients/consumer/Consumer
        at org.apache.spark.streaming.kafka010.ConsumerStrategies$.Subscribe(ConsumerStrategy.scala:256)
        at com.znv.facecluster.utils.SparkUtils$.getStreamFormKafka(SparkUtils.scala:40)
        at com.znv.facecluster.topic.FaceClusterTopic$.readPicture(FaceClusterTopic.scala:37)
        at com.znv.facecluster.topic.FaceClusterTopic$.process(FaceClusterTopic.scala:28)
        at com.znv.facecluster.entry.RealTimeFaceClusterApp$.main(RealTimeFaceClusterApp.scala:76)
        at com.znv.facecluster.entry.RealTimeFaceClusterApp.main(RealTimeFaceClusterApp.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$4.run(ApplicationMaster.scala:721)
    Caused by: java.lang.ClassNotFoundException: org.apache.kafka.clients.consumer.Consumer
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 11 more

    解决办法:--jars 添加kafka-clients-0.10.0.1.jar(版本根据需要修改)

  • 相关阅读:
    Clipper库中文文档详解
    JavaScript-Clipper.js
    安装Scrapy遇到的问题
    Python中if __name__ == '__main__'的使用
    写出一段Python代码实现删除一个list里面的重复元素
    Python 内置函数(反射类)
    Python 内置函数(集合操作,IO操作)
    Python 内置函数(数学运算类,逻辑判断类)
    Python 推导式(列表推导式,字典推导式,集合推导式)
    Python 闭包和装饰器
  • 原文地址:https://www.cnblogs.com/144823836yj/p/12486734.html
Copyright © 2020-2023  润新知