Exception in thread “main” org.apache.spark.SparkException: Only one SparkContext may be running in this JVM (see SPARK-2243)

后端 未结 3 935
说谎
说谎 2021-01-07 01:58

i am getting an error when i am trying to run a spark application with cassandra.

Exception in thread \"main\" org.apache.spark.SparkException: Only one Spar         


        
3条回答
  •  有刺的猬
    2021-01-07 02:45

    Take a look at the second code snippet here enter link description here

    This is how your code should look like

    import org.apache.spark.streaming.api.java.*;
    
    JavaSparkContext existingSparkContext = ...   //existing JavaSparkContext
    JavaStreamingContext activitySummaryScheduler = new JavaStreamingContext(existingSparkContext, Durations.seconds(1000));
    

提交回复
热议问题