HADOOP :: java.lang.ClassNotFoundException: WordCount

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
时间: 2024-11-04 09:00:16

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

运行hadoop的Wordcount程序报错java.lang.ClassNotFoundException: WordCount$TokenizerMapper

在运行hadoop的官方Wordcount程序时报错 java.lang.ClassNotFoundException: WordCount$TokenizerMapper 提示信息为找不到TokenizerMapper类,但程序师官方的,应该没错. 打包到Linux上可以运行,确定不是程序的错. 然后在网上搜索一番,看到有人说可能是eclipse版本原因,试了一下就ok了 使用的eclipse版本是3.5.1. 遇到此问题的兄弟们可以试一下

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

commons-lang3-3.3.2.jar 学习好友推荐案例的时候,提交运行时报错找不到StringUtils java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils [root@node01 ~]# hadoop jar MyFOF.jar com.sxt.hadoop.mr.fof.MyFOF 19/03/30 00:25:37 WARN mapreduce.JobResourceUploader: H

eclipse下执行wordcount报错 java.lang.ClassNotFoundException 解决办法

eclipse下执行wordcount报错 java.lang.ClassNotFoundException 17/08/29 07:52:54 INFO Configuration.deprecation: fs.default.name is deprecated. Instead, use fs.defaultFS 17/08/29 07:52:54 WARN util.NativeCodeLoader: Unable to load native-hadoop library for y

hadoop start-all.sh 启动出错java.lang.ClassNotFoundException: start-all.sh

在配置完hadoop 后,输入:bin/start-all.sh ,出现java.lang.ClassNotFoundException: start-all.sh 百度一番之后,在hadoop bin 目录下输入 ./start-all.sh,如图: 成功启动!

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$HotMapper not found at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2154) at org.apache.hadoop.mapreduce.task.JobContextImpl.getMap

hive启动报错 java.lang.ClassNotFoundException: org.apache.hadoop.mapred.MRVersion

[[email protected] hive-1.1.0-cdh5.7.0]$ hivewhich: no hbase in (/home/hadoop/app/hive-1.1.0-cdh5.7.0/bin:/home/hadoop/app/hadoop-2.8.1/bin:/usr/java/jdk1.8.0_45/bin:/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/hadoop/bin)E

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

在创建自定义的Mapper时候,编译正确,但上传到集群执行时出现错误: 11/16/05 22:53:16 INFO mapred.JobClient: Task Id : attempt_201111301626_0015_m_000000_0, Status : FAILED java.lang.RuntimeException: java.lang.ClassNotFoundException: actiondemo.MyJob$MapClass at org.apache.Hadoop.

spark取得lzo压缩文件报错 java.lang.ClassNotFoundException

恩,这个问题,反正是我从来没有注意的问题,但今天还是写出来吧 配置信息 hadoop core-site.xml配置 <property>    <name>io.compression.codecs</name>         <value>org.apache.hadoop.io.compress.GzipCodec,org.apache.hadoop.io.compress.DefaultCodec,com.hadoop.compression.lz

Caused by: java.lang.ClassNotFoundException: javax.persistence.Entity

1.错误描写叙述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help | start | stop } 2014-7-12 19:41:17 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.29 usi