2015-02-06 34 views
21

我嘗試使用Apache Spark執行簡單的項目。這是我的代碼SimpleApp.scala錯誤Utils:線程中未捕獲的異常SparkListenerBus

/* SimpleApp.scala */ 
import org.apache.spark.SparkContext 
import org.apache.spark.SparkContext._ 
import org.apache.spark.SparkConf 

object SimpleApp { 
    def main(args: Array[String]) { 
    val logFile = "/home/hduser/spark-1.2.0-bin-hadoop2.4/README.md" // Should be some file on your system 
    // val conf = new SparkConf().setAppName("Simple Application") 
    val sc = new SparkContext("local", "Simple Job", "/home/hduser/spark-1.2.0-bin-hadoop2.4/") 
    val logData = sc.textFile(logFile, 2).cache() 
    val numAs = logData.filter(line => line.contains("hadoop")).count() 
    val numBs = logData.filter(line => line.contains("see")).count() 
    println("Lines with hadoop: %s, Lines with see: %s".format(numAs, numBs)) 
    } 
} 

當我手動發送此作業的命令行星火:/home/hduser/spark-1.2.0-hadoop-2.4.0/bin/spark-submit --class "SimpleApp" --master local[4] target/scala-2.10/simple-project_2.10-1.0.jar它的成功運行。

如果我sbt run並與服務的Apache火花運行期間運行,這是成功的,但在記錄它的最後給的錯誤是這樣的:

15/02/06 15:56:49 ERROR Utils: Uncaught exception in thread SparkListenerBus 
java.lang.InterruptedException 
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:996) 
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1303) 
    at java.util.concurrent.Semaphore.acquire(Semaphore.java:317) 
    at org.apache.spark.scheduler.LiveListenerBus$$anon$1$$anonfun$run$1.apply$mcV$sp(LiveListenerBus.scala:48) 
    at org.apache.spark.scheduler.LiveListenerBus$$anon$1$$anonfun$run$1.apply(LiveListenerBus.scala:47) 
    at org.apache.spark.scheduler.LiveListenerBus$$anon$1$$anonfun$run$1.apply(LiveListenerBus.scala:47) 
    at org.apache.spark.util.Utils$.logUncaughtExceptions(Utils.scala:1460) 
    at org.apache.spark.scheduler.LiveListenerBus$$anon$1.run(LiveListenerBus.scala:46) 
15/02/06 15:56:49 ERROR ContextCleaner: Error in cleaning thread 
java.lang.InterruptedException 
    at java.lang.Object.wait(Native Method) 
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135) 
    at org.apache.spark.ContextCleaner$$anonfun$org$apache$spark$ContextCleaner$$keepCleaning$1.apply$mcV$sp(ContextCleaner.scala:136) 
    at org.apache.spark.ContextCleaner$$anonfun$org$apache$spark$ContextCleaner$$keepCleaning$1.apply(ContextCleaner.scala:134) 
    at org.apache.spark.ContextCleaner$$anonfun$org$apache$spark$ContextCleaner$$keepCleaning$1.apply(ContextCleaner.scala:134) 
    at org.apache.spark.util.Utils$.logUncaughtExceptions(Utils.scala:1460) 
    at org.apache.spark.ContextCleaner.org$apache$spark$ContextCleaner$$keepCleaning(ContextCleaner.scala:133) 
    at org.apache.spark.ContextCleaner$$anon$3.run(ContextCleaner.scala:65) 

在我的代碼的任何錯誤?提前致謝。 我使用Apache 1.2.0火花斌-Hadoop的2.4,斯卡拉2.10.4

回答

21

this mail archive,即:

嗨灝明,

您可以放心地忽略此錯誤。當我們清理並終止守護程序上下文清理 線程時,會在 執行結束時打印此信息。在將來,最好能夠消除這個特定的消息,因爲它可能會讓用戶感到困惑。

安德魯

錯誤可以忽略不計。

+0

哦,我看到先生。我認爲問題來自我的代碼,但實際上它是清理火花工作的日誌。謝謝你,先生。 – Bobs 2015-02-06 10:05:19

+0

此問題是否解決?我使用spark-1.5.1和hive-1.2.1在紗線簇模式下運行hive-on-spark。接收相同的錯誤「線程SparkListenerBus中的未捕獲錯誤,停止SparkContext java.lang.AbstractMethodError 」 – Arvindkumar 2015-10-22 11:50:56

+0

@Arvindkumar該問題已解決,現在,我可以正常使用它。 – Bobs 2016-02-06 08:26:27

34

的當火花代碼是通過在代碼的末尾添加sc.stopspark.stop(火花> = 2.0.0)運行SparkContextSparkSession(火花> = 2.0.0)應該被停止。

+0

謝謝,我忘了這件事。 – 2017-01-16 14:44:56

+0

我想這應該是答案。 – 2017-04-24 21:32:47

相關問題