原因: java.lang.NoClassDefFoundError: org/apache/spark/api/java/function/FlatMapFunction

x33g5p2x  于2022-05-16 转载在 Java  
字(0.6k)|赞(0)|评价(0)|浏览(402)

启动spark streaming失败,报错为:

原因: java.lang.NoClassDefFoundError: org/apache/spark/api/java/function/FlatMapFunction

解决:

在pom.xml里面,原配置

<dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-streaming_2.12</artifactId>
            <version>3.2.1</version>
            <scope>provided</scope>
        </dependency>

**<scope>provided</scope>**

删掉即可。变为:

<dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-streaming_2.12</artifactId>
            <version>3.2.1</version>
        </dependency>

相关文章