I'm submitting remote spark jobs to the Hadoop cluster. But getting below error message help me to solve this.
我正在向Hadoop集群提交远程火花作业。但是得到以下错误信息有助于我解决这个问题。
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FSDataInputStream
at org.apache.spark.Logging$.<init>(Logging.scala:162)
at org.apache.spark.Logging$.<clinit>(Logging.scala)
at org.apache.spark.Logging$class.initializeIfNecessary(Logging.scala:103)
at org.apache.spark.Logging$class.log(Logging.scala:50)
at org.apache.spark.deploy.yarn.ApplicationMaster$.log(ApplicationMaster.scala:635)
at org.apache.spark.deploy.yarn.ApplicationMaster$.main(ApplicationMaster.scala:649)
at org.apache.spark.deploy.yarn.ExecutorLauncher$.main(ApplicationMaster.scala:674)
at org.apache.spark.deploy.yarn.ExecutorLauncher.main(ApplicationMaster.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.fs.FSDataInputStream
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 8 more
3 个解决方案
#1
0
It looks like you're using a Spark distribution that was pre-built for user-provided Hadoop. Try downloading a distribution that says "Pre-built for Hadoop 2.x or later", where x would be your existing Hadoop cluster version, and see if it works for you.
看起来您正在使用为用户提供的Hadoop预先构建的Spark发行版。尝试下载“预先为Hadoop 2.x或更高版本构建”的发行版,其中x将是您现有的Hadoop集群版本,并查看它是否适合您。
#2
0
The problem was with the classpath.
问题出在classpath上。
I've added below code to the application and it solved the issue:
我已经在应用程序中添加了以下代码,它解决了这个问题:
.set("spark.hadoop.yarn.application.classpath",
"/etc/hadoop/conf,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop/lib/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop-hdfs/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop-hdfs/lib/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop-mapreduce/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop-mapreduce/lib/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop-yarn/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop-yarn/lib/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/spark/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/spark/lib/*")
#3
0
To resolve this issue run spark with the following command:
要解决此问题,请使用以下命令运行spark:
/usr/local/spark/bin/spark-shell
#1
0
It looks like you're using a Spark distribution that was pre-built for user-provided Hadoop. Try downloading a distribution that says "Pre-built for Hadoop 2.x or later", where x would be your existing Hadoop cluster version, and see if it works for you.
看起来您正在使用为用户提供的Hadoop预先构建的Spark发行版。尝试下载“预先为Hadoop 2.x或更高版本构建”的发行版,其中x将是您现有的Hadoop集群版本,并查看它是否适合您。
#2
0
The problem was with the classpath.
问题出在classpath上。
I've added below code to the application and it solved the issue:
我已经在应用程序中添加了以下代码,它解决了这个问题:
.set("spark.hadoop.yarn.application.classpath",
"/etc/hadoop/conf,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop/lib/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop-hdfs/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop-hdfs/lib/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop-mapreduce/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop-mapreduce/lib/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop-yarn/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/hadoop-yarn/lib/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/spark/*,"
+ "/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p0.11/lib/spark/lib/*")
#3
0
To resolve this issue run spark with the following command:
要解决此问题,请使用以下命令运行spark:
/usr/local/spark/bin/spark-shell