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. 中国用户mac上快速安装nodejs

    mac nodejs 安装 1.http://npm.taobao.org/mirrors/node/latest/ 进入这个域名,然后找到最新的pkg包下载过来 2.双击pkg包,下一步下一步安装 ...

  2. 【T-SQL系列】FOR XML PATH 语句的应用

    DECLARE @TempTable TABLE ( UserID INT , UserName ) ); INSERT INTO @TempTable ( UserID, UserName ) , ...

  3. 用Jquery获取select的value和text值

    $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 var checkText=$(&q ...

  4. windows 环境变量 %SystemDrive% 和 %SystemRoot%

    %SYSTEMROOT% == c:\windows (or the root windows directory) %SYSTEMDRIVE% == the drive windows is ins ...

  5. centos 解压rar文件

    默认情况下centos是不支持winrar的解压与打包的,需要安装winrar的linux版本程序 首先得下载解压软件 wget http://www.rarsoft.com/rar/rarlinux ...

  6. hibernate.properties和hibernate.cfg.xml

    hibernate.properties和hibernate.cfg.xml 博客分类: 框架技术 HibernateXMLSQLOracleJDBC     hibernate配置文件可以有两种方式 ...

  7. ORA-00205

    场景 数据库启动时报错.关闭前还是正常运行的,再次启动时,就报了以下错误. Copyright (c) , , Oracle. All rights reserved. Connected to an ...

  8. spring-mvc 与 openid4java

    以GoogleOpenID 为例,试验了OAuth单点登录的用法: <dependency> <groupId>org.openid4java</groupId> ...

  9. nfs服务器设置

    前段时间重新装了一下Linux系统,结果导致NFS服务器总是挂在不成功,于是粗略学习了一下: NFS服务需要两个软件包: 1.nfs-utiles-* 2.portmap-* nfsd:它是基本的NF ...

  10. Selenium处理时间控件

    Web网页的时间控件往往嵌入到一个iframe里,抓取页面元素时,总是失败? 不要慌,WebDriver已经有相应的处理方法了. driver.switchTo().frame(driver.find ...