在flink项目中跑
上面这段代码出现如下这个异常,
java.lang.NoClassDefFoundError: org/apache/thrift/TException
加上下面这个依赖后不报错
<dependency> <groupId>org.apache.thrift</groupId> <artifactId>libthrift</artifactId> <version>0.9.3</version> </dependency>
但又包下面这个错
org/apache/hadoop/hive/ql/parse/SemanticException
网上找原因说是因为在pom中没加hive相关依赖,然后把如下两个依赖加上:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>3.3.4</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
<version>3.1.3</version>
</dependency>
再跑
成功!