Spark启动时报JAVA_HOME is not set异常

Spark启动时报JAVA_HOME is not set异常

报错提示:

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

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异常_第1张图片

报错原因:

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

解决方法:

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

你可能感兴趣的:(Spark,spark,大数据,apache,hadoop,zookeeper)