I am using eclipse to export the jar file of a map-reduce program. When i am run the jar using command

 hadoop jar hadoop-prog.jar WordCount /home/temp/input /home/temp/output

it always shows the error :

   Exception in thread "main" java.lang.ClassNotFoundException: WordCount
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.apache.hadoop.util.RunJar.main(RunJar.java:149)

Btw, I get a sample example jar file of wordcount from internet and it ran very well.

I could not figure out where is the problem.

答案

If you're trying to run the wordcount provided in the examples, you should run:

hadoop jar hadoop*examples*.jar wordcount /home/temp/input /home/temp/output

More info on how to run wordcount on this link.

In general, if you're developing your own Map/Reduce jobs, you should include the full package name of your driver class, so something like this might work:

hadoop jar wordcount.jar com.something.WordCount /home/temp/input /home/temp/output

HADOOP :: java.lang.ClassNotFoundException: WordCount的更多相关文章

  1. Hadoop java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils

    .jar 学习好友推荐案例的时候,提交运行时报错找不到StringUtils java.lang.ClassNotFoundException: org.apache.commons.lang3.St ...

  2. 生成HFile文件后倒入数据出现Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.filter.Filter

    数据导入的时候出现: at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclar ...

  3. ERROR tool.ImportTool: Import failed: java.io.IOException: java.lang.ClassNotFoundException: org.apache.hadoop.hive.conf.HiveConf

    sqoop从mysql导入到hive报错: 18/08/22 13:30:53 ERROR tool.ImportTool: Import failed: java.io.IOException: j ...

  4. sqoop mysql--->hive 报错 (ERROR tool.ImportTool: Import failed: java.io.IOException: java.lang.ClassNotFoundException: org.apache.hadoop.hive.conf.HiveConf)

    ERROR tool.ImportTool: Import failed: java.io.IOException: java.lang.ClassNotFoundException: org.apa ...

  5. Hadoop 运行jar包时 java.lang.ClassNotFoundException: Class com.zhen.mr.RunJob$HotMapper not found

    错误如下 Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.zhen.mr.RunJob$H ...

  6. eclipse下执行maprdeuc程序报错 java.lang.ClassNotFoundException

    最近遇到一个问题,不知怎么突然运行hadoop的map程序报错,困扰了我很久,现在来给大家分享分享.. 错误信息 2017-05-18 21:34:22,104 INFO [main] client. ...

  7. MapReduce 程序运行报错 java.lang.ClassNotFoundException解决方法

    在创建自定义的Mapper时候,编译正确,但上传到集群执行时出现错误: 11/16/05 22:53:16 INFO mapred.JobClient: Task Id : attempt_20111 ...

  8. java.lang.RuntimeException: java.lang.ClassNotFoundException: cmd.CmdWordCount$MyMapper解决方法

    14/02/28 20:29:48 INFO mapred.JobClient: Task Id : attempt_201402281833_0004_m_000000_1, Status : FA ...

  9. Exception in thread "main" java.lang.ClassNotFoundException: 解决方法

    [root@h1 ~]# hadoop jar W1.jar hdfs://h1:9000/hello hdfs://h1:9000/cmd Exception in thread "mai ...

随机推荐

  1. hdu 2196 Computer 树的直径

    Computer Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem ...

  2. HTML笔记(七)head相关元素<base> & <meta>

    <head>元素是所有头部元素的容器. 可添加的标签有:<title>.<base>.<link>.<meta>.<script> ...

  3. DOM 操作XML(CRUD)

    <?xml version="1.0" encoding="UTF-8" standalone="no"?><书架> ...

  4. Spring读书笔记-----使用Spring容器(二)

    一.使用ApplicationContext 前面介绍了,我们一般不会使用BeanFactory实例作为Spring容器,而是使用ApplicationContext实例作为容器,它增强了BeanFa ...

  5. MyEclipse8.5启动无法选择工作空间的问题

    方法一:打开Window---Preferences---General---Startup and Shutdown,勾选Prompt for workspace on startup 选项,再次登 ...

  6. return

    return作为返回关键字,有以下两种意义的返回格式: 1,返回把握与函数成果:停止函数执行,返回调用函数,并且把函数的值作为返回成果. turn只能退出当前函数,如果多个函数嵌套就不行了,要想整个退 ...

  7. Virtualbox虚拟机安装CentOS6.5图文详细教程(zhuan)

    http://www.2cto.com/os/201407/318477.html ************************************************* 什么是Virtu ...

  8. !!转!!hashCode与equals的区别与联系

    这篇文章写得很好!!! 原文链接:http://blog.csdn.net/afgasdg/article/details/6889383 一.equals方法的作用 1.默认情况(没有覆盖equal ...

  9. html list <==> unformatted list

    两者的区别很大不得不擦呢,任何两个东西的差别都很大,不得混淆.---一个有ul/ol的选择,一个没有

  10. Canu FAQ常见问题

    链接:Canu FAQ Q: What resources does Canu require for a bacterial genome assembly(细菌基因组组装)?   A mammal ...