maven 由java.lang.NoClassDefFoundError引起的SparkException:org/apache/htrace/core/HTraceConfiguration

9lowa7mx  于 2023-06-21  发布在  Maven
关注(0)|答案(1)|浏览(191)

在jar包中似乎没有找到HTraceConfiguration类。但是,我确实在jar包中找到了这个类。

jar ftv app.jar  | grep HTraceConfiguration

2814 Tue Jul 10 17:26:52 CST 2018 org/apache/hadoop/hbase/trace/HBaseHTraceConfiguration.class
1202 Thu Sep 15 10:07:46 CST 2016 org/apache/htrace/core/HTraceConfiguration$MapConf.class
3249 Thu Sep 15 10:07:46 CST 2016 org/apache/htrace/core/HTraceConfiguration.class

但是,为什么执行任务时会抛出NoClassDefFoundError?
下面是异常堆栈跟踪

aused by: org.apache.spark.SparkException: Job aborted due to stage failure: Task 31 in stage 119.0 failed 4 times, most recent failure: Lost task 31.3 in stage 119.0 (TID 1024) (172.20.2.15 executor 2): org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException: Failed 1 action: java.lang.NoClassDefFoundError: org/apache/htrace/core/HTraceConfiguration: 1 time, servers with issues: null
    at org.apache.hadoop.hbase.client.BatchErrors.makeException(BatchErrors.java:50)
    at org.apache.hadoop.hbase.client.AsyncRequestFutureImpl.getErrors(AsyncRequestFutureImpl.java:1195)
    at org.apache.hadoop.hbase.client.BufferedMutatorImpl.doFlush(BufferedMutatorImpl.java:298)
    at org.apache.hadoop.hbase.client.BufferedMutatorImpl.flush(BufferedMutatorImpl.java:270)
    at org.apache.hadoop.hbase.spark.HBaseContext.hbaseForeachPartition(HBaseContext.scala:481)
    at org.apache.hadoop.hbase.spark.HBaseContext.$anonfun$bulkPut$1$adapted(HBaseContext.scala:221)
    at org.apache.spark.rdd.RDD.$anonfun$foreachPartition$2(RDD.scala:1011)
    at org.apache.spark.rdd.RDD.$anonfun$foreachPartition$2$adapted(RDD.scala:1011)
    at org.apache.spark.SparkContext.$anonfun$runJob$5(SparkContext.scala:2278)
    at org.apache.spark.scheduler.Task.run(Task.scala:136)
    at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$3(Executor.scala:548)
    at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1504)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:551)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Driver stacktrace:
    at org.apache.spark.scheduler.DAGScheduler.failJobAndIndependentStages(DAGScheduler.scala:2672)
    at org.apache.spark.scheduler.DAGScheduler.$anonfun$abortStage$2(DAGScheduler.scala:2608)
    at org.apache.spark.scheduler.DAGScheduler.$anonfun$abortStage$2$adapted(DAGScheduler.scala:2607)
    at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:2607)
    at org.apache.spark.scheduler.DAGScheduler.$anonfun$handleTaskSetFailed$1(DAGScheduler.scala:1182)
    at org.apache.spark.scheduler.DAGScheduler.$anonfun$handleTaskSetFailed$1$adapted(DAGScheduler.scala:1182)
    at scala.Option.foreach(Option.scala:407)
    at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:1182)
    at org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:952)
    at org.apache.spark.SparkContext.runJob(SparkContext.scala:2238)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.RDD.foreachPartition(RDD.scala:1009)
    at org.apache.hadoop.hbase.spark.HBaseContext.bulkPut(HBaseContext.scala:221)
    at org.apache.hadoop.hbase.spark.HBaseRDDFunctions$GenericHBaseRDDFunctions.hbaseBulkPut(HBaseRDDFunctions.scala:60)
    at scala.collection.Iterator.foreach(Iterator.scala:943)
    at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
    at scala.collection.AbstractIterable.foreach(Iterable.scala:56)

    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

你能告诉我发生了什么吗?

bfnvny8b

bfnvny8b1#

如果您使用spark-submit启动作业,请添加--jars参数和jar的路径。它将被添加到executor的类路径中。

相关问题