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
7,688 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,220 points
1,742 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
• 11,380 points
11,028 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
• 11,380 points
2,535 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
108,831 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,350 points
4,611 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,220 points
3,582 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
989 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP