无法在火花zeppelin中加载hivecontext

时间:2016-01-12 16:53:08

标签: scala apache-spark hive apache-zeppelin

我安装了zeppelin。除非我尝试导入配置单元上下文,否则一切正常。

Zeppelin上的我的配置:

System.getenv().get("MASTER")
System.getenv().get("SPARK_YARN_JAR")
System.getenv().get("HADOOP_CONF_DIR")
System.getenv().get("JAVA_HOME")
System.getenv().get("SPARK_HOME")
System.getenv().get("PYSPARK_PYTHON")
System.getenv().get("PYTHONPATH")
System.getenv().get("ZEPPELIN_JAVA_OPTS")

res0: String = yarn-client
res1: String = /home/centos/zeppelin-R-rscala/interpreter/spark/zeppelin-spark-0.6.0-incubating-SNAPSHOT.jar
res2: String = /etc/hadoop/conf
res3: String = /usr/jdk64/jdk1.8.0_60
res4: String = /usr/hdp/2.3.4.0-3485/spark
res5: String = null
res6: String = /usr/hdp/current/spark-client/python/lib/py4j-0.8.2.1-src.zip:/usr/hdp/current/spark-client/python/:
res7: String = -Dhdp.version=2.3.4.0-3485

我尝试做什么

%spark
val hiveContext = new org.apache.spark.sql.hive.HiveContext(sc)

我有错误:

 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:193)
    at org.apache.spark.sql.hive.HiveContext.executionHive$lzycompute(HiveContext.scala:164)
    at org.apache.spark.sql.hive.HiveContext.executionHive(HiveContext.scala:162)
    at org.apache.spark.sql.hive.HiveContext.functionRegistry$lzycompute(HiveContext.scala:415)

请注意,如果我直接从shell启动,一切正常。

由于

1 个答案:

答案 0 :(得分:2)

这可能意味着您将Tez作为Hive的执行引擎。您应该在用于Spark的hive-site.xml中更改该属性:

<property>
  <name>hive.execution.engine</name>
  <value>mr</value>
</property>

在我的情况下,我不得不通过Ambari更改它,但这取决于您的设置。