简体   繁体   中英

hadoop:Not able to run a mapreduce job

I have made 3 files in java,made a jar file and wrote this line to execute the MapReduce code:

hadoop jar /home/xyz/Documents/hadoop-2.7.3/abc1.jar woq.WordCount /test/vocab.txt /test/output3

The jar filename is abc1.jar , woq is the package name and WordCount is the main class in which the job is defined for mapreduce code.When this line is executed,following error is displayed:

Exception in thread "main" java.lang.ClassNotFoundException: woq.WordCount
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:214)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

Any suggestions on what I point am I missing in executing the above line?

Output of the grep command(in comments):

   Sun Jan 22 21:04:20 IST 2017 WordCountMapper.class
   Sun Jan 22 21:04:20 IST 2017 WordCountReducer.class
   Sun Jan 22 21:04:20 IST 2017 WordCount.class

From the comments,

The class files appear to have the line package woq; in them without the acutal directory structure. You can either create a parent directory woq or remove that line from the files and recompile it.

If you remove the line, you can submit the job like this

hadoop jar /home/xyz/Documents/hadoop-2.7.3/abc1.jar WordCount /test/vocab.txt /test/output3

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