kafka报错:java.lang.NoClassDefFoundError: org/apache/kafka/common/serialization/StringDeserializer

一:问题

spark streaming使用kafaka时,将jar包上传服务器运行时报错:如下图
kafka报错:java.lang.NoClassDefFoundError: org/apache/kafka/common/serialization/StringDeserializer_第1张图片

二:原因及解决

原因: 缺少kafka相关的依赖包。

引入maven:

  <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka-clients</artifactId>
  </dependency>

你可能感兴趣的:(spark,kafka,spark,streaming,java,kafka,spark)