Huawei-Spark / Spark-SQL-on-HBase

Native, optimized access to HBase Data through Spark SQL/Dataframe Interfaces
Apache License 2.0
321 stars 164 forks source link

HBasePartition not found in yarn cluster #4

Closed secfree closed 9 years ago

secfree commented 9 years ago

在 spark 以 yarn-clinet 方式提交到 yarn 集群时, 尝试各种方式将 spark-sql-on-hbase-1.0.0.jar 上传到 executor. 确认该 jar 文件已经存在于 nodemanager 机器上, 但是还是报错:

15/07/30 19:05:05 INFO DAGScheduler: Job 3 failed: main at NativeMethodAccessorImpl.java:-2, took 0.088777 s
org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 3.0 failed 4 times, most recent failure: Lost task 0.3 in stage 3.0 (TID 12, szwg-scloud-2015q2-c32-s
u04.szwg01.baidu.com): java.lang.ClassNotFoundException: org.apache.spark.sql.hbase.HBasePartition
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at org.apache.spark.serializer.JavaDeserializationStream$$anon$1.resolveClass(JavaSerializer.scala:66)
yzhou2001 commented 9 years ago

Have you add the jar to the SPARK_CLASSPATH in the spark-env.sh file on all slave machines plus the spark driver machine?

Or have you tried not using the Yarn as your resource manager?

You might also want to ask around to see any of your colleagues has an immediate answer for this type of seemingly trivial issues before resorting to the github bug list.

secfree commented 9 years ago

First, SPARK_CLASSPATH is a deprecated environment variable, --jars may be a better option.

I add the file spark-sql-on-hbase-1.0.0.jar to YARN's default classpath $HADOOP_COMMON_HOME/share/hadoop/common/lib/*, which can be found in yarn-default.xml of property yarn.application.classpath.

Then I restart the cluster and I found the reason:

2015-08-03 00:27:26,092 WARN org.mortbay.log: Failed to read file: /opt/hadoop-2.6.0/share/hadoop/yarn/spark-sql-on-hbase-1.0.0.jar
java.util.zip.ZipException: invalid CEN header (bad signature)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:131)
        at java.util.jar.JarFile.<init>(JarFile.java:150)
        at java.util.jar.JarFile.<init>(JarFile.java:114

Here is a explanation: java.util.zip.ZipException: invalid CEN header (bad signature)