Spark创建HiveContext报错tez的问题
Posted 郭小白
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spark创建HiveContext报错tez的问题相关的知识,希望对你有一定的参考价值。
java.lang.NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning
报错信息
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:529)
at org.apache.spark.sql.hive.client.ClientWrapper.<init>(ClientWrapper.scala:204)
at org.apache.spark.sql.hive.client.IsolatedClientLoader.createClient(IsolatedClientLoader.scala:238)
at org.apache.spark.sql.hive.HiveContext.executionHive$lzycompute(HiveContext.scala:218)
at org.apache.spark.sql.hive.HiveContext.executionHive(HiveContext.scala:208)
at org.apache.spark.sql.hive.HiveContext.setConf(HiveContext.scala:440)
at org.apache.spark.sql.SQLContext$$anonfun$4.apply(SQLContext.scala:272)
at org.apache.spark.sql.SQLContext$$anonfun$4.apply(SQLContext.scala:271)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at org.apache.spark.sql.SQLContext.<init>(SQLContext.scala:271)
at org.apache.spark.sql.hive.HiveContext.<init>(HiveContext.scala:90)
at org.apache.spark.sql.hive.HiveContext.<init>(HiveContext.scala:101)
at com.winner.clu.spark.batch.analysis.AccPresetConditionData.mainFun(AccPresetConditionData.scala:60)
at com.winner.clu.spark.batch.BatchJobMain$.main(BatchJobMain.scala:53)
at com.winner.clu.spark.batch.BatchJobMain.main(BatchJobMain.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.tez.dag.api.SessionNotRunning
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 18 more
问题描述
idea在进行本地程序调试的时候,创建HiveContext时报错,tez包的问题
问题原因
本地开发在hive-site.xml
需要将tez的引擎替换掉
处理方案
更改hive-site.xml
中的tez
引擎为spark
或mr
,如下图:
以上是关于Spark创建HiveContext报错tez的问题的主要内容,如果未能解决你的问题,请参考以下文章
Spark SQL HiveContext - saveAsTable 创建错误的架构
Spark SQL(通过 HiveContext 进行 Hive 查询)总是创建 31 个分区