线程“main”java.lang.noclassdeffounderror中出现异常:org/apache/hadoop/util/runjar

bq3bfh9z  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(452)

我基本上是在尝试在远程节点上运行mad reduce作业,我面临下面提到的异常。有人经历过同样的问题吗?我正在发布scipt,我正在使用它设置类路径并启动作业。


# !/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.
5vf7fwbs

5vf7fwbs1#

将hadoop\u home更改为hadoop\u前缀
确保hadoop选择了正确的java版本
您可以在hadoop-env.conf中配置必要的java
请重试$hadoop版本

相关问题