如何解决spark-shell 中的 HBase SparkContext 类型不匹配
我正在尝试在 spark-shell
中使用 HBase。有两个集群:Cloudera 和 Hortonwork。 Cloudera 集群执行完美的命令,而 Hortonwork one 以相同的命令失败并出现奇怪的错误:
scala> new HBaseContext(sc,conf)
<console>:30: error: type mismatch;
found : org.apache.spark.org.apache.spark.org.apache.spark.org.apache.spark.org.apache.spark.SparkContext
required: org.apache.spark.org.apache.spark.org.apache.spark.org.apache.spark.org.apache.spark.SparkContext
Error occurred in an application involving default arguments.
new HBaseContext(sc,conf)
^
以下是 spark-shell
在 HDP 上的更详细输出:
scala> import org.apach.hadoop.hbase.HBaseConfiguration
import org.apach.hadoop.hbase.HBaseConfiguration
warning: Class org.apache.yetus.audience.InterfaceAudience not found - continuing with a stub
scala> import org.apache.hadoop.hbase.spark.HBaseContext
org.apache.hadoop.hbase.spark.HBaseContext
warning: Class org.apache.yetus.audience.InterfaceAudience not found - continuing with a stub
error: missing or invalid dependency detected while loading class file 'HBaseContext.class'.
Could not access term yetus in package org.apache,because it (or its dependencies) are missing. Check your build definition for
missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'HBaseContext.class' was compiled against an incompatible version of org.apache.
error: missing or invalid dependency detected while loading class file 'HBaseContext.class'.
Could not access term audience in value org.apache.yetus,because it (or its dependencies) are missing. Check your build definition for
missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'HBaseContext.class' was compiled against an incompatible version of org.apache.yetus.
scala> val conf = HBaseConfiguration.create()
conf: org.apache.hadoop.conf.Configuration = Configuration: core-default.xml,core-site.xml,mapred-default.xml,mapred-site.xml,yarn-default.xml,yarn-site.xml,hdfs-default.xml,hdfs-site.xml,hbase-defaul.xml,hbase-site.xml
scala> conf.addResource(new Path("/etc/hbase/3.0.1.0-187/0/hbase-site.xml")
scala> new HBaseContext(sc,conf)
^
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。