简体   繁体   English

java.lang.NoSuchMethodError:org.apache.spark.storage.BlockManager

[英]java.lang.NoSuchMethodError: org.apache.spark.storage.BlockManager

I am getting the following error message while I am connecting to a kinesis stream. 当我连接到运动流时,出现以下错误消息。

java.lang.NoSuchMethodError: org.apache.spark.storage.BlockManager.get(Lorg/apache/spark/storage/BlockId;)Lscala/Option;
    at org.apache.spark.streaming.kinesis.KinesisBackedBlockRDD.getBlockFromBlockManager$1(KinesisBackedBlockRDD.scala:104)

My spark streaming code is, 我的火花流代码是

sc = SparkContext(appName="PythonStreamingTest")
ssc = StreamingContext(sc, 10)
dstream = KinesisUtils.createStream(
    ssc, "PythonStreamingTest", "questions", "https://kinesis.us-west-2.amazonaws.com", "us-west-2", InitialPositionInStream.TRIM_HORIZON, 1)
dstream.foreachRDD(stream_rdd)

def stream_rdd(rdd):
    if not rdd.isEmpty():
        return rdd.foreach(classify)

def classify(ele):
    if ele!="":
        print ele

Initially, the stream comes blank as it takes a while to connect to the Kinesis stream. 最初,该流变为空白,因为需要一段时间才能连接到Kinesis流。 But then all of a sudden, it breaks down the code. 但是突然之间,它破坏了代码。 The rest of the trace is, 剩下的痕迹是,

17/04/02 17:52:00 ERROR Executor: Exception in task 0.0 in stage 1.0 (TID 1)
java.lang.NoSuchMethodError: org.apache.spark.storage.BlockManager.get(Lorg/apache/spark/storage/BlockId;)Lscala/Option;
    at org.apache.spark.streaming.kinesis.KinesisBackedBlockRDD.getBlockFromBlockManager$1(KinesisBackedBlockRDD.scala:104)
    at org.apache.spark.streaming.kinesis.KinesisBackedBlockRDD.compute(KinesisBackedBlockRDD.scala:117)
    at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:323)
    at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
    at org.apache.spark.api.python.PythonRDD.compute(PythonRDD.scala:63)
    at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:323)
    at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
    at org.apache.spark.api.python.PythonRDD.compute(PythonRDD.scala:63)
    at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:323)
    at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
    at org.apache.spark.scheduler.Task.run(Task.scala:99)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:282)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

I submit my job using the following command, 我使用以下命令提交工作,

spark-submit --jars spark-streaming-kinesis-asl-assembly_2.11-2.0.0.jar --driver-memory 5g Question_Type_Classification_testing_purpose/classifier_streaming.py

I am running the code on a local machine. 我在本地计算机上运行代码。 So if I am giving 5g of memory, the executor should work fine. 因此,如果我要提供5g的内存,则执行程序应该可以正常工作。 The same code works for Spark 1.6. 相同的代码适用于Spark 1.6。 Recently I changed to Spark 2.1 and I am not able to run this code. 最近,我更改为Spark 2.1,但无法运行此代码。 I updated my kinesis jar and Py4j as well. 我也更新了我的运动罐和Py4j。

I tested my code by writing a Kinesis consumer, and it gets the stream perfectly fine. 我通过编写Kinesis使用者来测试我的代码,它可以完美地完成流。

Can anyone please let me know what can be the possible issue? 谁能让我知道可能是什么问题? Is the empty stream creating an issue? 空流是否会引起问题? If yes, why am I getting an empty stream while using Spark streaming? 如果是,为什么在使用Spark流时会出现空流? Any help is really appreciated. 任何帮助都非常感谢。

spark-streaming-kinesis-asl is Spark's own internal library and is using Spark internal APIs (eg, BlockManager.get). spark-streaming-kinesis-asl是Spark自己的内部库,并且正在使用Spark内部API(例如BlockManager.get)。 The method signature of BlockManager.get was changed in https://github.com/apache/spark/commit/29cfab3f1524c5690be675d24dda0a9a1806d6ff#diff-2b643ea78c1add0381754b1f47eec132L605 so you will see NoSuchMethodError if the Spark version is >= 2.0.1 but spark-streaming-kinesis-asl version is < 2.0.1. BlockManager.get的方法签名已在https://github.com/apache/spark/commit/29cfab3f1524c5690be675d24dda0a9a1806d6ff#diff-2b643ea78c1add0381754b1f47eec132L605中进行了更改,因此如果Spark版本为> = 2.0.1,但spark-streaming-kinesis-asl ,您将看到NoSuchMethodError spark-streaming-kinesis-asl版本小于2.0.1。

Generally, because Spark doesn't promise not breaking internal APIs between releases, you must use spark-streaming-kinesis-asl with the same version of Spark. 通常,由于Spark不能保证不会在发行版之间破坏内部API,因此必须将spark-streaming-kinesis-asl与相同版本的Spark配合使用。

For latest Spark releases, the kinesis asl assembly jar was removed because of the potential license issue [1], hence you may not be able to find the assembly jar. 对于最新的Spark版本,由于潜在的许可证问题[1],已删除了kinesis asl组装罐,因此您可能找不到组装罐。 However, you can use --packages org.apache.spark:spark-streaming-kinesis-asl_2.11:2.1.0 to add spark-streaming-kinesis-asl and its dependencies into the classpath automatically, rather than building the assembly jar by yourself. 但是,您可以使用--packages org.apache.spark:spark-streaming-kinesis-asl_2.11:2.1.0spark-streaming-kinesis-asl及其依赖项自动添加到类路径中,而不用构建程序集jar由你自己。

[1] https://issues.apache.org/jira/browse/SPARK-17418 [1] https://issues.apache.org/jira/browse/SPARK-17418

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Apache Spark:java.lang.NoSuchMethodError .rddToPairRDDFunctions - Apache Spark: java.lang.NoSuchMethodError .rddToPairRDDFunctions Apache点燃并引发迭代错误java.lang.NoSuchMethodError:org.apache.spark.sql.SQLContext.createDataFrame - Apache ignite and spark itegration error java.lang.NoSuchMethodError: org.apache.spark.sql.SQLContext.createDataFrame 结构化Spark Streaming抛出java.lang.NoSuchMethodError:org.apache.spark.sql.SQLContext.internalCreateDataFrame - Structured Spark Streaming throwing java.lang.NoSuchMethodError: org.apache.spark.sql.SQLContext.internalCreateDataFrame 无法运行火花壳! java.lang.NoSuchMethodError:org.apache.spark.repl.SparkILoop.mumly - Can't run spark shell ! java.lang.NoSuchMethodError: org.apache.spark.repl.SparkILoop.mumly java.lang.NoSuchMethodError:org.apache.spark.sql.hive.HiveContext.sql(Ljava / lang / String;)Lorg / apache / spark / sql / DataFrame - java.lang.NoSuchMethodError: org.apache.spark.sql.hive.HiveContext.sql(Ljava/lang/String;)Lorg/apache/spark/sql/DataFrame 如何解决java.lang.NoSuchMethodError org.apache.spark.ml.util.SchemaUtils $ .checkColumnType - How to resolve java.lang.NoSuchMethodError org.apache.spark.ml.util.SchemaUtils$.checkColumnType 使用java.lang.NoSuchMethodError火花读取HBase:org.apache.hadoop.mapreduce.InputSplit.getLocationInfo错误 - Spark Read HBase with java.lang.NoSuchMethodError: org.apache.hadoop.mapreduce.InputSplit.getLocationInfo error java.lang.NoSuchMethodError:org.apache.spark.sql.DataFrameReader.parquet - java.lang.NoSuchMethodError: org.apache.spark.sql.DataFrameReader.parquet java.lang.NoSuchMethodError: org.apache.spark.sql.internal.SQLConf.useDeprecatedKafkaOffsetFetching()Z - java.lang.NoSuchMethodError: org.apache.spark.sql.internal.SQLConf.useDeprecatedKafkaOffsetFetching()Z java.lang.NoSuchMethodError: org.apache.spark.internal.Logging.$init$ - java.lang.NoSuchMethodError: org.apache.spark.internal.Logging.$init$
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM