java.lang.IllegalArgumentException: Unable to instantiate SparkSession with Hive support because Hive classes are not found.

0 votes

I had tried to use hive tables in spark sql the folowing is the sparksesion instance

spark_Session = SparkSession
.builder()
.appName("Spark_Sql_Project")
.master("local[*]")
.enableHiveSupport()
.config("spark.sql.warehouse-dir","/uer/hive/warehouse")
.getOrCreate()

If I run the code in scala ide I am getting following error

"java.lang.IllegalArgumentException: Unable to instantiate SparkSession with Hive support because Hive classes are not found."
Jul 30, 2019 in Big Data Hadoop by Will
1,630 views

1 answer to this question.

+1 vote

 Try using the below build.sbt, code.scala and command for connecting to hive from spark.

build.sbt

name := "Hive Spark"

version := "1.0"

scalaVersion := "2.11.8"

libraryDependencies += "org.apache.spark" %% "spark-core" % "2.1.0"

libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.1.0"

hive_connect.scala

import org.apache.spark.sql.Row

import org.apache.spark.sql.SparkSession

import org.apache.spark.sql.types._

object hive_connect{

def main(args: Array[String]) {

val sparkSession = SparkSession.builder.master("local").appName("demo").enableHiveSupport().getOrCreate()

sparkSession.sqlContext.sql(“use sayni”)

sparkSession.sqlContext.sql(“show tables”).show()

}

}

And your command should look something like this:

spark2-submit --class hive_connect --deploy-mode client /mnt/home/edureka_425640/hive_connect/target/scala-2.11/hive-spark_2.11-1.0.jar

answered Jul 30, 2019 by Kishan

Related Questions In Big Data Hadoop

0 votes
1 answer

Unable to instantiate org.apache.hadoop.hive

You might not have set the connector. ...READ MORE

answered Jan 25, 2019 in Big Data Hadoop by Omkar
• 69,000 points
207 views
0 votes
1 answer
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,870 points
4,556 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,870 points
648 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
25,877 views
–1 vote
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,310 points
1,713 views
0 votes
1 answer

Hadoop Hive: message:Version information not found in metastore. Unable to instantiate

These are the necessary tables required for metastore that are ...READ MORE

answered Nov 12, 2018 in Big Data Hadoop by Omkar
• 69,000 points
1,030 views
0 votes
1 answer

Unable to instantiate hive metastore

To resolve this issue, follow the steps ...READ MORE

answered Jul 5, 2019 in Big Data Hadoop by Ritu
91 views