简体   繁体   中英

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. 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. The below is what is present in the sh file and none of the class files are bundled in the installation. 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. I missed those being a n00b to Hadoop. To launch those 2 processes, type start-yarn and start-dfs from a command window. They both launch 2 console windows each and spit out a lot of diagnostic info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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