欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Spark启动时报JAVA_HOME is not set异常

程序员文章站 2022-07-14 15:20:35
...

Spark启动时报JAVA_HOME is not set异常

报错提示:

starting org.apache.spark.deploy.master.Master, logging to /opt/wdp/spark/logs/spark-hadoop-org.apache.spark.deploy.master.Master-1-hrbu30.out
hrbu32: starting org.apache.spark.deploy.worker.Worker, logging to /opt/wdp/spark/logs/spark-hadoop-org.apache.spark.deploy.worker.Worker-1-hrbu32.out
hrbu31: starting org.apache.spark.deploy.worker.Worker, logging to /opt/wdp/spark/logs/spark-hadoop-org.apache.spark.deploy.worker.Worker-1-hrbu31.out
hrbu30: starting org.apache.spark.deploy.worker.Worker, logging to /opt/wdp/spark/logs/spark-hadoop-org.apache.spark.deploy.worker.Worker-1-hrbu30.out
hrbu32: failed to launch: nice -n 0 /opt/wdp/spark/bin/spark-class org.apache.spark.deploy.worker.Worker --webui-port 8081 spark://hrbu30:7077
hrbu32:   JAVA_HOME is not set
hrbu32: full log in /opt/wdp/spark/logs/spark-hadoop-org.apache.spark.deploy.worker.Worker-1-hrbu32.out
hrbu31: failed to launch: nice -n 0 /opt/wdp/spark/bin/spark-class org.apache.spark.deploy.worker.Worker --webui-port 8081 spark://hrbu30:7077
hrbu31:   JAVA_HOME is not set
hrbu31: full log in /opt/wdp/spark/logs/spark-hadoop-org.apache.spark.deploy.worker.Worker-1-hrbu31.out
hrbu30: failed to launch: nice -n 0 /opt/wdp/spark/bin/spark-class org.apache.spark.deploy.worker.Worker --webui-port 8081 spark://hrbu30:7077
hrbu30:   JAVA_HOME is not set
hrbu30: full log in /opt/wdp/spark/logs/spark-hadoop-org.apache.spark.deploy.worker.Worker-1-hrbu30.out

Spark启动时报JAVA_HOME is not set异常

报错原因:

Spark找不到jdk,所以应在Spark中配置jdk的路径

解决方法:

修改sbin目录下的spark-config.sh,添加jdk的环境变量,再次启动spark就正常了
Spark启动时报JAVA_HOME is not set异常
Spark启动时报JAVA_HOME is not set异常