程序使用sparksql 以及protobuf grpc ,执行报错
ApplicationMaster: Final app status: FAILED, exitCode: 13, (reason: Uncaught exception: java.lang.IllegalStateException: User did not initialize spark context!
先说原因 :
- 1.使用了不具备权限的用户,spark运行环境有缺失
- 2.protobuf 需要使用指定操作系统进行编译 未使用 os.detected.classifier=windows-x86_64 或 linux-x86_64,或者把windows上编译的jar直接拿过来使用导致
- 3.protobuf的版本不太合适 这个比较坑,得多注意
- 4.代码中指定了运行模式是local( 这个因为没写local,没遇到 )
-
解决
- 1.使用root用户,或者将当前用户加入到sudo 权限范围,之后sudo执行
- 2.本机 编译的放到linux执行会报错,因此需要在master节点编译 指定os.detected.classifier=linux-x86_64 例如 maven执行的命令
-
mvn clean package -P prod -Dos.detected.classifier=linux-x86_64 -Dmaven.test.skip=true
- 3. pom中版本调整
-
protobuf-maven-plugin 0.6.1 降到 0.5.0 同时 io.grpc:protoc-gen-grpc-java:1.54.0 com.google.protobuf:protoc:21.0-rc-1
升版本 0.5.0升到 0.6.1 同时 io.grpc:protoc-gen-grpc-java:3.21.9 com.google.protobuf:protoc:3.21.9文章来源:https://www.toymoban.com/news/detail-686750.html - 4.去掉 sparksession指定local的运行设定代码
etc: 中间也出现过 编译问题 “protoc CreateProcess error=216, 该版本的 %1 与您运行的 Windows 版本不兼容”,这个的处理就不说了。文章来源地址https://www.toymoban.com/news/detail-686750.html
到了这里,关于spark grpc 在master运行报错 exitcode13 User did not initialize spark context的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!