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 in Big Data Hadoop by Will
56 views

1 answer to this question.

0 votes

 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 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 in Big Data Hadoop by Omkar
• 67,290 points
86 views
0 votes
1 answer

Why am I not able to see the Hadoop daemons that are running?

I guess you are starting the services ...READ MORE

answered Apr 18, 2018 in Big Data Hadoop by Shubham
• 13,290 points
65 views
0 votes
1 answer
0 votes
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,510 points
2,404 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,510 points
245 views
0 votes
10 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
12,232 views
0 votes
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,240 points
898 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
• 67,290 points
228 views
0 votes
1 answer

Unable to instantiate hive metastore

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

answered Jul 5 in Big Data Hadoop by Ritu
28 views