Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
MapReduce, mail # user - ClassNotFoundException in Main

Copy link to this message
ClassNotFoundException in Main
Fatih Haltas 2013-02-19, 13:47
Hi everyone,

I know this is the common mistake to not specify the class adress while
trying to run a jar, however,
although I specified, I am still getting the ClassNotFound exception.

What may be the reason for it? I have been struggling for this problem more
than a 2 days.
I just wrote different MapReduce application for some anlaysis. I got this

To check, is there something wrong with my system, i tried to run WordCount
When I just run hadoop-examples wordcount, it is working fine.

But when I add just "package org.myorg;" command at the beginning, it
doesnot work.

Here is what I have done so far
1. I just copied wordcount code from the apaches own examples source code
and I just changed package decleration as "package org.myorg;"
2. Then I tried to run that command:
"hadoop jar wordcount_19_02.jar org.myorg.WordCount
/home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.output"
3. I got following error:
[hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
org.myorg.WordCount /home/hadoop/project/hadoop-data/NetFlow
Warning: $HADOOP_HOME is deprecated.

Exception in thread "main" java.lang.ClassNotFoundException:
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:266)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:149)

4. This is the content of my .jar file:
[hadoop@ADUAE042-LAP-V project]$ jar tf wordcount_19_02.jar
5. This is the 'ls' output of my working directory:
[hadoop@ADUAE042-LAP-V project]$ ls
flowclasses_18_02  flowclasses_18_02.jar  hadoop-1.0.4  hadoop-1.0.4.tar.gz
 hadoop-data  MapReduce.java  sample  wordcount_19_02.jar
 wordcount_classes  WordCountClasses  WordCount.java
So as you see, package decleration is fine but I am really helpless, I
googled but they are all saying samething you should specify the package
hierarchy of your main class. I did know it already I am specifying but
doesn't work.

I would be much obliged to anyone helped me

Hemanth Yamijala 2013-02-19, 16:02
Fatih Haltas 2013-02-19, 16:08
Fatih Haltas 2013-02-19, 16:20
Hemanth Yamijala 2013-02-19, 16:40
Fatih Haltas 2013-02-19, 16:53
Hemanth Yamijala 2013-02-19, 17:05