Exception in thread “main“ java.lang.IllegalArgumentException: Unable to instantiate SparkSession wi

问题

Exception in thread “main” java.lang.IllegalArgumentException: Unable to instantiate SparkSession with Hive support because Hive classes are not found.

详细问题

springboot集成spark,创建sparkSession对象后,对于sparkSession对象添加hive支持,控制台报错

Exception in thread "main" java.lang.IllegalArgumentException: Unable to instantiate SparkSession with Hive support because Hive classes are not found.
	at org.apache.spark.sql.SparkSession$Builder.enableHiveSupport(SparkSession.scala:869)
	at com.haut.edu.epidemicstatisticsbackend2.controller.Test_Hive.main(Test_Hive.java:103)

解决方案

在pom文件中增加依赖

<dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-hive_2.11</artifactId>
    <version>2.4.4</version>
</dependency>

原因

由于sparkSession对象添加hive支持,因此需要导入spark-hive_2.11依赖

参考文献

Unable to instantiate SparkSession with Hive support because Hive classes are not found.

原创不易
转载请标明出处
如果对你有所帮助 别忘啦点赞支持哈
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/T_Y_F_/article/details/128877218
今日推荐