SparkStreaming報錯: Only one SparkContext may be running in this JVM (see SPARK-2243)
報錯資訊:
Exception in thread "main" org.apache.spark.SparkException:
Only one SparkContext may be running in this JVM (see SPARK-2243).
To ignore this error, set spark.driver.allowMultipleContexts = true.
The currently running SparkContext was created at:
org.apache.spark.api.java.JavaSparkContext
原因:
出現這個問題的原因就是你建立了多個 SparkContext
,就像下面這種用法,只需要幹掉J avaSparkContext
就可:
SparkConf conf = new SparkConf()
.setAppName(“myapplication”).setMaster(“local[4]”);
JavaSparkContext jsc = new JavaSparkContext(conf);
JavaStreamingContext stream = new JavaStreamingContext(conf, Durations.seconds(10));
解決這個問題兩種方式:
方式1:
SparkConf conf = new SparkConf()
.setAppName(“myapplication”) .setMaster(“local[4]”);
JavaStreamingContext stream = new JavaStreamingContext(conf, Durations.seconds(10));
方式2:
SparkConf conf = new SparkConf()
.setAppName(“myapplication”).setMaster(“local[4]”);
JavaSparkContext jsc = new JavaSparkContext(conf);
JavaStreamingContext stream = new JavaStreamingContext(jsc, Durations.seconds(10));
相關文章
- iOS 阿里雲OSS Start resolved network to see if in IPv6-Only env. 報錯iOS阿里
- 使用monaco編輯器 報錯Can only have one anonymous define call per script file
- 報錯-only final is permittedMIT
- Mingw GCC 編譯OpenCV報錯: Project files may be invalidGC編譯OpenCVProject
- 【報錯】elasticsearch 報錯blocked by: [FORBIDDEN/12/index read-only / allow delete (api)]ElasticsearchBloCORBIndexdeleteAPI
- MySQL 報錯'Variable 'XXX' is a read only variable'MySql
- vue報錯之Duplicate keys detected: '0'. This may cause an update error.VueError
- 執行hadoop作業 No job jar file set. User classes may not be found. See Job orHadoopJAR
- Swift代理報錯Optional can only be applied to members of an @objc protocolSwiftAPPOBJProtocol
- 解決報錯error the @annotation pointcut expression is only supported at Java 5ErrorExpressJava
- iOS報錯:linker command failed with exit code 1 (use -v to see invocation)iOSAI
- hadoop報錯:could only be replicated to 0 nodes, instead of 1Hadoop
- IDEA 報錯Failed to load JVM DLLIdeaAIJVM
- zeppelin spark SparkContext問題 Cannot call methods on a stopped SparkContextSparkContext
- "ScrollView can host only one direct child"問題解決View
- One git command may cause you hacked(CVE-2014-9390)Git
- mysql 5.7啟動報錯"Expected to open undo tablespaces but was able to find only 0"MySql
- MySQL 報錯 ERROR 1290 (HY000): running with the --secure-file-privMySqlError
- 解決使用jedis連線是報DENIED Redis is running in protected mode錯誤Redis
- Laravel-查詢-ONLY_FULL_GROUP_BY SQL 模式-報錯限制-解決LaravelSQL模式
- React報錯之React.Children.only expected to receive single React element childReact
- cornerstone the server may be unreachable or the url may be incorrectServer
- SQL2012報錯:cannot find one or more cpmponentsSQL
- 提交spark程式到yarn出現ERROR SparkContext: Error initializing SparkContext.SparkYarnErrorContext
- 關於Android Studio的This item may not have a label readable by screen readers報錯Android
- MS-SQL 錯誤: The offset specified in a OFFSET clause may not be negativeSQL
- 巢狀錯誤Inline markup blocks (@<p>Content</p>) cannot be nested. Only one level of inline markup is allowed巢狀inlineBloC
- 【Leetcode】1180. Count Substrings with Only One Distinct LetterLeetCode
- error C2713: Only one form of exception handling permitted per functionErrorORMExceptionMITFunction
- ORACLE OCM備考OEM搭建DG報錯:NMO not setuid-root(Unix-only)OracleUI
- MySQL報錯Table 'plugin' is read only [ERROR] Can't open the mysql.plugin table.MySqlPluginError
- 踩坑系列:MySql only_full_group_by配置,竟導致所有應用報錯?MySql
- Spark-2.4.0原始碼:sparkContextSpark原始碼Context
- Spark 原始碼解析之SparkContextSpark原始碼Context
- SparkStreaming VS Structed StreaminSparkStruct
- sparkStreaming 之 kafka源SparkKafka
- Flume + Kafka + SparkStreaming分析KafkaSpark
- MySQL 中出現報錯提示: ‘Variable ‘XXX‘ is a read only variable‘的解決方法MySql