简体   繁体   English

缺少Hadoop 2.2.0 jar文件

[英]Hadoop 2.2.0 jar files missing

I have hadoop-2.2.0 installed and was trying to run the mapreduce examples code that comes bundled with it. 我已经安装了hadoop-2.2.0,并试图运行它附带的mapreduce示例代码。 But, it fails every time with the ClassNotFoundException and the reason I found out is because of what is set up in the hadoop.sh file. 但是,每次使用ClassNotFoundException都会失败,而我发现的原因是hadoop.sh文件中设置的hadoop.sh The below is what is present in the sh file and none of the class files are bundled in the installation. 以下是sh文件中提供的内容,安装中未捆绑任何类文件。 I do see that they are present in the source. 我确实看到它们出现在源代码中。

if [ "$COMMAND" = "fs" ] ; then
  CLASS=org.apache.hadoop.fs.FsShell
elif [ "$COMMAND" = "version" ] ; then
  CLASS=org.apache.hadoop.util.VersionInfo
elif [ "$COMMAND" = "jar" ] ; then
  CLASS=org.apache.hadoop.util.RunJar
elif [ "$COMMAND" = "checknative" ] ; then
  CLASS=org.apache.hadoop.util.NativeLibraryChecker
elif [ "$COMMAND" = "distcp" ] ; then
  CLASS=org.apache.hadoop.tools.DistCp
  CLASSPATH=${CLASSPATH}:${TOOL_PATH}
elif [ "$COMMAND" = "daemonlog" ] ; then
  CLASS=org.apache.hadoop.log.LogLevel
elif [ "$COMMAND" = "archive" ] ; then
  CLASS=org.apache.hadoop.tools.HadoopArchives
  CLASSPATH=${CLASSPATH}:${TOOL_PATH}
elif [[ "$COMMAND" = -*  ]] ; then
    # class and package names cannot begin with a -
    echo "Error: No command named \`$COMMAND' was found. Perhaps you meant \`hadoop ${COMMAND#-}'"
    exit 1
else
  CLASS=$COMMAND

Here is the error: 这是错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.hadoop.util.RunJar
   at gnu.java.lang.MainThread.run(libgcj.so.13)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.RunJar not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/local/hadoop-2.2.0/etc/hadoop/,file:/usr/local/hadoop-2.2.0/share/hadoop/hdfs/], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
   at java.net.URLClassLoader.findClass(libgcj.so.13)
   at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.13)
   at java.lang.ClassLoader.loadClass(libgcj.so.13)
   at java.lang.ClassLoader.loadClass(libgcj.so.13)
   at gnu.java.lang.MainThread.run(libgcj.so.13)

I finally figured out the issue. 我终于弄清楚了这个问题。 The YARN (for mapreduce) and DFS processes needs to be running in the background to run any hadoop job. YARN(用于mapreduce)和DFS进程需要在后台运行才能运行任何hadoop作业。 I missed those being a n00b to Hadoop. 我想念那些成为Hadoop的n00b的人。 To launch those 2 processes, type start-yarn and start-dfs from a command window. 要启动这两个进程,请在命令窗口中键入start-yarnstart-dfs They both launch 2 console windows each and spit out a lot of diagnostic info. 他们每个都启动2个控制台窗口,并吐出很多诊断信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM