0

我目前正在 Cloudera Express 5.5.0 上使用 SAP HANA Vora 迈出第一步。

Vora 服务器已启动并正在运行,我现在想使用 Vora spark shell,但这就是我得到的:

sh start-spark-shell.sh 
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/launcher/Main
Caused by: java.lang.ClassNotFoundException: org.apache.spark.launcher.Main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.apache.spark.launcher.Main.  Program will exit.

这就是我的环境的样子:

export LD_LIBRARY_PATH=/opt/cloudera/parcels/CDH/lib/hadoop/lib/native
export JAVA_HOME=/usr/java/default
export HADOOP_PARCEL_PATH=/opt/cloudera/parcels/CDH
export HADOOP_CONF_DIR=/etc/hadoop/conf
export SPARK_HOME=/usr/lib/spark
export SPARK_CONF_DIR=$SPARK_HOME/conf
export PATH=$PATH:$SPARK_HOME/bin

SPARK_DIST_CLASSPATH=$SPARK_HOME/lib/spark-assembly.jar
SPARK_DIST_CLASSPATH=$SPARK_DIST_CLASSPATH:$HADOOP_PARCEL_PATH/lib/hadoop/lib/*
SPARK_DIST_CLASSPATH=$SPARK_DIST_CLASSPATH:$HADOOP_PARCEL_PATH/lib/hadoop/*
SPARK_DIST_CLASSPATH=$SPARK_DIST_CLASSPATH:$HADOOP_PARCEL_PATH/lib/hadoop-hdfs/lib/*
SPARK_DIST_CLASSPATH=$SPARK_DIST_CLASSPATH:$HADOOP_PARCEL_PATH/lib/hadoop-hdfs/*
SPARK_DIST_CLASSPATH=$SPARK_DIST_CLASSPATH:$HADOOP_PARCEL_PATH/lib/hadoop-mapreduce/lib/*
SPARK_DIST_CLASSPATH=$SPARK_DIST_CLASSPATH:$HADOOP_PARCEL_PATH/lib/hadoop-mapreduce/*
SPARK_DIST_CLASSPATH=$SPARK_DIST_CLASSPATH:$HADOOP_PARCEL_PATH/lib/hadoop-yarn/lib/*
SPARK_DIST_CLASSPATH=$SPARK_DIST_CLASSPATH:$HADOOP_PARCEL_PATH/lib/hadoop-yarn/*
SPARK_DIST_CLASSPATH=$SPARK_DIST_CLASSPATH:$HADOOP_PARCEL_PATH/lib/hive/lib/*
SPARK_DIST_CLASSPATH=$SPARK_DIST_CLASSPATH:$HADOOP_PARCEL_PATH/lib/flume-ng/lib/*
SPARK_DIST_CLASSPATH=$SPARK_DIST_CLASSPATH:$HADOOP_PARCEL_PATH/lib/parquet/lib/*
SPARK_DIST_CLASSPATH=$SPARK_DIST_CLASSPATH:$HADOOP_PARCEL_PATH/lib/avro/lib/*
export SPARK_DIST_CLASSPATH
4

2 回答 2

0

解决了。

只需要将 Java 从 JDK6 升级到 JDK7。确保您设置了以下环境变量(检查安装时的值):

export LD_LIBRARY_PATH=/opt/cloudera/parcels/CDH/lib/hadoop/lib/native
export JAVA_HOME=/usr/java/default
export HADOOP_PARCEL_PATH=/opt/cloudera/parcels/CDH
export HADOOP_CONF_DIR=/etc/hadoop/conf
export SPARK_HOME=/usr/lib/spark
export SPARK_CONF_DIR=$SPARK_HOME/conf
export PATH=$PATH:$SPARK_HOME/bin
于 2016-02-17T21:48:42.257 回答
0

感谢您的回答https://stackoverflow.com/users/1867854/michael-kunzmann。我发现JDK7已经安装在/usr/java/jdk1.7.0_67-cloudera目录下。我认为这是 Cloudera Manager 安装的一个步骤。在撰写本文时,CDH 5.3、5.5、5.6 的最低支持版本为 1.7.0_55(例如,请参阅https://www.cloudera.com/documentation/enterprise/5-6-x/topics/cdh_ig_req_supported_versions.html#concept_pdd_kzf_vp

我正在尝试使用标准(非 Vora)火花壳,并在 CDH 上遇到了同样的问题。所以标准 spark-shell 也需要 JDK7。Vora spark-shell 脚本..

$VORA_SPARK_HOME/bin/start-spark-shell.sh

...只需将 Vora 数据源 jar 添加为附加库。

仅供参考,这是 Cloudera CDH 上标准 spark-shell 的示例。

~> cd /usr/java
/usr/java> ls -l
total 8
lrwxrwxrwx 1 lroot root   16 Dec 17  2015 default -> /usr/java/latest
drwxr-xr-x 9 lroot root 4096 Dec 17  2015 jdk1.6.0_31
drwxr-xr-x 8 lroot root 4096 Dec 17  2015 jdk1.7.0_67-cloudera
lrwxrwxrwx 1 lroot root   21 Dec 17  2015 latest -> /usr/java/jdk1.6.0_31
/usr/java> export JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera
/usr/java> export SPARK_HOME=/usr/lib/spark
/usr/java> cd $SPARK_HOME
/usr/lib/spark> ./bin/spark-shell

仅供参考,我在 HortonWorks 上也有 Vora。Java 7 已经通过 /usr/bin/java 符号链接在 PATH 上,这只是工作..

source /etc/vora/vora-env.sh
$VORA_SPARK_HOME/bin/start-spark-shell.sh
于 2016-06-29T14:32:33.957 回答