1

以下是我在 spark 应用程序中的代码块,用于从 hbase 表中删除一组行键(rePartitionedRowKeys),

hbaseContext.bulkDelete[Array[Byte]](rePartitionedRowKeys,
        TableName.valueOf(hbaseTableName),
        putRecord => new Delete(putRecord), batchSize)

pom.xml 中的相关依赖项是,

<dependency>
    <groupId>org.apache.hbase</groupId>
    <artifactId>hbase-spark</artifactId>
    <version>1.2.0-cdh5.7.0</version>
    <scope>compile</scope>
</dependency>        
<dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-streaming_2.10</artifactId>
    <version>1.6.0-cdh5.7.0</version>
    <scope>provided</scope>
</dependency>

当我运行应用程序时,我得到了其中一种日志方法的 AbstractMethodError,

org.apache.spark.SparkException: Job aborted due to stage failure: Task 3 in stage 4.0 failed 4 times, most recent failure: Lost task 3.3 in stage 4.0 (TID 17, c175vjt.int.westgroup.com, executor 2): java.lang.AbstractMethodError: org.apache.hadoop.hbase.spark.HBaseContext.initializeLogIfNecessary(Z)V
    at org.apache.spark.Logging$class.log(Logging.scala:50)
    at org.apache.hadoop.hbase.spark.HBaseContext.log(HBaseContext.scala:60)
    at org.apache.spark.Logging$class.logDebug(Logging.scala:62)
    at org.apache.hadoop.hbase.spark.HBaseContext.logDebug(HBaseContext.scala:60)
    at org.apache.hadoop.hbase.spark.HBaseContext.applyCreds(HBaseContext.scala:235)
    at org.apache.hadoop.hbase.spark.HBaseContext.org$apache$hadoop$hbase$spark$HBaseContext$$hbaseForeachPartition(HBaseContext.scala:482)
    at org.apache.hadoop.hbase.spark.HBaseContext$$anonfun$org$apache$hadoop$hbase$spark$HBaseContext$$bulkMutation$1.apply(HBaseContext.scala:322)
    at org.apache.hadoop.hbase.spark.HBaseContext$$anonfun$org$apache$hadoop$hbase$spark$HBaseContext$$bulkMutation$1.apply(HBaseContext.scala:322)
    at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$33.apply(RDD.scala:920)
    at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$33.apply(RDD.scala:920)
    at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:1866)
    at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:1866)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:66)
    at org.apache.spark.scheduler.Task.run(Task.scala:89)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:242)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Driver stacktrace:
    at org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1457) ~[spark-assembly-1.6.0-cdh5.10.2-hadoop2.6.0-cdh5.10.2.jar:na]
    at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1445) ~[spark-assembly-1.6.0-cdh5.10.2-hadoop2.6.0-cdh5.10.2.jar:na]
    at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1444) ~[spark-assembly-1.6.0-cdh5.10.2-hadoop2.6.0-cdh5.10.2.jar:na]

我是否缺少任何依赖项 jar 或者是由于 jar 冲突?提前致谢

4

1 回答 1

2

我在 Spark 1.5.1 中使用 CDH5.5.7 jar,但与 spark-hbase 相关的 jar 指向 cdh5.7.0。

然后我将 CDH 版本升级到 5.10.2,并使所有其他 jar 与 cdh5.10.2 兼容,从而解决了 AbstractMethodError。

于 2017-11-17T13:43:33.257 回答