Run Jar for WordCount


3 Answer(s)


Hi,
Below are the command to run mapreduce job with your generated jar
hadoop jar /home/cloudera/myWorksp/WordCountv2/deploy/wCountJar.jar wordcount

Hadoop v2 is called Yarn.

Got below error
[cloudera@localhost ~]$ sudo -u hdfs hadoop jar /home/cloudera/myWorksp/WordCountv2/deploy/wCountJar.jar wordcount
Exception in thread "main" java.io.IOException: Error opening job jar: /home/cloudera/myWorksp/WordCountv2/deploy/wCountJar.jar
at org.apache.hadoop.util.RunJar.main(RunJar.java:135)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:127)
at java.util.jar.JarFile.(JarFile.java:135)
at java.util.jar.JarFile.(JarFile.java:72)
at org.apache.hadoop.util.RunJar.main(RunJar.java:133)
[cloudera@localhost ~]$


I believe first parameter should be path and name of file in which we need to check wordCount.
Could you please let me know where test file is located and how to pass parameter.

Hi,
As shown in the error, hadoop is not able to extract the jar file.
Please check and confirm whether jar file is working.