启动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>