线程" main"中的例外情况java.lang.NoClassDefFoundError:org / apache / hadoop / util / RunJar

时间:2014-07-11 22:23:39

标签: hadoop hadoop2

我基本上试图在远程节点上运行疯狂的reduce工作,我正面临下面提到的异常。有人经历过同样的问题吗?我正在发布我正用于设置类路径并启动作业的文件。

#!/bin/bash

export JAVA_HOME=/usr/java/jdk7
export HADOOP_HOME=/usr/local/hadoop/hadoop-2.4.0
export CONF=/home/hadoop/p2Cluster/conf
export PATH=$CONF:$HADOOP_HOME/bin:$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$CONF:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export HADOOP_CONF_DIR=$CONF
echo "classpath=$CLASSPATH"
#
C2=""
JARS=`find $HADOOP_HOME -name '*hadoop*.jar'`
for j in $JARS
do
echo "$j"
export CLASSPATH=$CLASSPATH:$j
C2=$C2,$j
done

client=******
jobQueueName=default
JAR=****.jar
export HADOOP_CLASS_PATH=$CLASSPATH
hadoop jar $JAR $client  interactive 2 groupA.txt groupB.txt
#
#java $client  interactive 2 groupA.txt groupB.txt $jobQueueName
exit 0



error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/util/RunJar
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.RunJar
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.hadoop.util.RunJar.  Program will exit.

1 个答案:

答案 0 :(得分:0)

  1. 将HADOOP_HOME更改为HADOOP_PREFIX
  2. 确保hadoop选择正确的java版本
  3. 您可以在hadoop-env.conf中配置必要的java
  4. 再试一次$ hadoop version