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


写一个maven模块的时候出现了这样一个Exception:

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

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


这是因为没有在这个模块的pom里边把hive支持加进来。

解决办法:

在工程模块中找到hive依赖,然后在执行的当前模块中添加hive依赖

<dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-hive_2.11</artifactId>
    <version>${spark.version}</version>
    <!--<scope>provided</scope>-->
</dependency>

添加进去,等依赖全导进去以后,在执行程序就好使了

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