简体   繁体   中英

Hadoop map-Reduce program not runing

I'm new to Hadoop MapReduce. When I'm trying to run my MapReduce code using the following command:

vishal@XXXX bin/hadoop jar /user/vishal/WordCount com.WordCount.java /user/vishal/file01 /user/vishal/output.

It displays the following output:

   Exception in thread "main" java.io.IOException: Error opening job jar: /user/vishal/WordCount.jar     
    at org.apache.hadoop.util.RunJar.main(RunJar.java:130)          
    Caused by: java.util.zip.ZipException: error in opening zip file    
    at java.util.zip.ZipFile.open(Native Method)     
    at java.util.zip.ZipFile.<init>(ZipFile.java:131)    
    at java.util.jar.JarFile.<init>(JarFile.java:150)    
    at java.util.jar.JarFile.<init>(JarFile.java:87)    
    at org.apache.hadoop.util.RunJar.main(RunJar.java:128)

How can I fix this error?

Your command is asking Hadoop to run a JAR but is specifying a directory instead.

You have also added '.java' to the class name, which is not required. (This is assuming you have written the package name, com.WordCount , correctly).

First build the jar in /user/vishal/WordCount.jar (ensure this is a local directory, not HDFS) then run the command without the '.java' at the end of the class name. Also, you put a dot at the end of the command in your question, I hope that isn't there in the real command.

bin/hadoop jar /user/vishal/WordCount.jar com.WordCount /user/vishal/file01 /user/vishal/output

See the Hadoop tutorial's 'Usage' section for more.

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