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阿里
- 報錯-only final is permittedMIT
- 使用monaco編輯器 報錯Can only have one anonymous define call per script file
- zabbix-server is not running 報錯解決Server
- Mingw GCC 編譯OpenCV報錯: Project files may be invalidGC編譯OpenCVProject
- 【報錯】elasticsearch 報錯blocked by: [FORBIDDEN/12/index read-only / allow delete (api)]ElasticsearchBloCORBIndexdeleteAPI
- One git command may cause you hacked(CVE-2014-9390)Git
- 【Leetcode】1180. Count Substrings with Only One Distinct LetterLeetCode
- vue報錯之Duplicate keys detected: '0'. This may cause an update error.VueError
- MySQL 報錯 ERROR 1290 (HY000): running with the --secure-file-privMySqlError
- 關於Android Studio的This item may not have a label readable by screen readers報錯Android
- IDEA 報錯Failed to load JVM DLLIdeaAIJVM
- "ScrollView can host only one direct child"問題解決View
- SQL2012報錯:cannot find one or more cpmponentsSQL
- springboot啟動時報異常Class not found so assuming code is running on a pre-Java 9 JVMSpring BootJavaJVM
- 解決使用jedis連線是報DENIED Redis is running in protected mode錯誤Redis
- React報錯之React.Children.only expected to receive single React element childReact
- Spark-2.4.0原始碼:sparkContextSpark原始碼Context
- Laravel-查詢-ONLY_FULL_GROUP_BY SQL 模式-報錯限制-解決LaravelSQL模式
- MySQL 中出現報錯提示: ‘Variable ‘XXX‘ is a read only variable‘的解決方法MySql
- MySQL報錯Table 'plugin' is read only [ERROR] Can't open the mysql.plugin table.MySqlPluginError
- ORACLE OCM備考OEM搭建DG報錯:NMO not setuid-root(Unix-only)OracleUI
- 錯誤Error during artifact deployment. See server log for details.ErrorServerAI
- 啟動IDEA 報 failed to load jvm dll XXX 錯誤IdeaAIJVM
- Docker執行命令報錯:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?Docker
- AndroidStudio之自定義輸出包名報錯 Cannot set the value of read-only property 'outputFile' forAndroid
- 踩坑系列:MySql only_full_group_by配置,竟導致所有應用報錯?MySql
- 執行新增和修改操作報錯connection is read-only. Queries leading to data modification are not allowed
- 解決報錯 cuDNN error: CUDNN_STATUS_NOT_SUPPORTED. This error may appear if you passed in a non-contiguous input.DNNErrorAPP
- sparkStreaming 之 kafka源SparkKafka
- SparkStreaming VS Structed StreaminSparkStruct
- MySQL sql_mode=only_full_group_by 錯誤MySql
- Android之Retrofit報錯Form-encoded method must contain at least one @Field.AndroidORMAIAST
- RTSP播放器EasyPlayer.js報錯The play() request was interrupted because video-only background media播放器JSIDE
- mysql 禁用 ONLY_FULL_GROUP_BY,暫時解決錯誤(sql_mode=only_full_group_by)MySql
- Nginx下出現 see security.limit_extensions錯誤的解決方法NginxMIT
- IDEA啟動時報Failed to create JVM錯誤的解決IdeaAIJVM
- 大資料-SparkStreaming(一)大資料Spark