Spark Streaming Failed to read chec
現象
使用spark-submit提交一個Spark Streaming Application至yarn叢集, 報錯
Caused by: java.lang.ClassNotFoundException: XXXStartup$$anonfun$9 at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:266) at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:623) at org.apache.spark.streaming.ObjectInputStreamWithLoader.resolveClass(Checkpoint.scala:286) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1610) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1515) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348) at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1704) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1342) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348) at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1704) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1342) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989) at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:499) at org.apache.spark.streaming.DStreamGraph$$anonfun$readObject$1.apply$mcV$sp(DStreamGraph.scala:188) at org.apache.spark.util.Utils$.tryOrIOException(Utils.scala:1138) ... 31 more Exception in thread "main" org.apache.spark.SparkException: Failed to read checkpoint from directory XXX_startup at org.apache.spark.streaming.CheckpointReader$.read(Checkpoint.scala:272) at org.apache.spark.streaming.StreamingContext$.getOrCreate(StreamingContext.scala:624) at XXXStartup$.main(XXXStartup.scala:79) at XXXStartup.main(XXXStartup.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:569) at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:166) at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:189) at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:110) at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
解決方案及原因
StreamingContext是這樣建立的:
val createStreamingContext = (checkPointDir: String) => { val sparkConf = new SparkConf().setAppName(topic) val sparkContext = new SparkContext(sparkConf) @transient val streamingContext = new StreamingContext(sparkContext, Seconds(args(1).toInt)) streamingContext.checkpoint(checkPointDir) streamingContext } val checkPointDir = AppConf.strCheckPointPrefix + topic val streamingContext = StreamingContext.getOrCreate(checkPointDir, () => createStreamingContext(checkPointDir))
重新編譯application jar包之後, 再次提交app之前沒有清除checkpoint目錄下已經存在的之前的application生成的checkpoint檔案導致. 清除之後再提交即可
作者:牛肉圓粉不加蔥
連結:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/2334/viewspace-2818897/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Spark學習進度11-Spark Streaming&Structured StreamingSparkStruct
- Spark 系列(十四)—— Spark Streaming 基本操作Spark
- Spark 系列(十五)—— Spark Streaming 整合 FlumeSpark
- spark學習筆記-- Spark StreamingSpark筆記
- Spark Streaming Backpressure分析Spark
- Spark Streaming入門Spark
- Spark學習筆記(三)-Spark StreamingSpark筆記
- Spark Streaming學習——DStreamSpark
- Spark Streaming VS FlinkSpark
- Spark Streaming 流式處理Spark
- spark-streaming之 socketTextStreamSpark
- Spark Streaming :基本工作原理Spark
- Spark Streaming 效能優化Spark優化
- Spark Streaming 入門指南Spark
- Spark Streaming + Spark SQL 實現配置化ETSparkSQL
- Spark 以及 spark streaming 核心原理及實踐Spark
- Spark Structured Streaming 解析 JSONSparkStructJSON
- Cris 的 Spark Streaming 筆記Spark筆記
- Spark Streaming中的Window操作Spark
- Spark Streaming之dataset例項Spark
- Storm與Spark Streaming比較ORMSpark
- spark基礎之spark streaming的checkpoint機制Spark
- Spark Streaming監聽HDFS檔案(Spark-shell)Spark
- Spark Streaming 的容錯機制Spark
- Spark-Streaming的學習使用Spark
- Spark Streaming的PIDRateEstimator與backpressureSpark
- spark structed streaming 寫入hudi表SparkStruct
- Spark Streaming基礎概念介紹Spark
- 實戰|使用Spark Streaming寫入HudiSpark
- Spark Streaming 生產、消費流程梳理Spark
- Spark Streaming(六):快取與持久化Spark快取持久化
- Spark Streaming--開窗函式over()Spark函式
- Spark Streaming 之 Kafka 偏移量管理SparkKafka
- Spark Streaming簡單入門(示例+原理)Spark
- Spark Streaming和Flink的區別Spark
- Spark Streaming中的操作函式分析Spark函式
- Spark Streaming函式的分析與理解Spark函式
- Spark Streaming——Spark第一代實時計算引擎Spark