You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Fatih Haltas <fa...@nyu.edu> on 2013/02/19 14:47:33 UTC

ClassNotFoundException in Main

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
problem.

To check, is there something wrong with my system, i tried to run WordCount
example.
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
19_02_wordcount.output
Warning: $HADOOP_HOME is deprecated.

Exception in thread "main" java.lang.ClassNotFoundException:
org.myorg.WordCount
        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
META-INF/
META-INF/MANIFEST.MF
wordcount_classes/
wordcount_classes/org/
wordcount_classes/org/myorg/
wordcount_classes/org/myorg/WordCount.class
wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
wordcount_classes/org/myorg/WordCount$IntSumReducer.class
**********************************************************
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

Regards,

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
Thats because the error is not related to the packaging. As mentioned in my
last mail, downgrade the java version used for compiling your code from Jdk
7 to Jdk 6. If you are using an IDE, it will have an option to set the
target compilation version. Google will help.


On Tuesday, February 19, 2013, Fatih Haltas wrote:

> Yes i reorganized the packages but still i am getting same error my hadoop
> version is 1.0.4
>
> 19 Şubat 2013 Salı tarihinde Hemanth Yamijala adlı kullanıcı şöyle yazdı:
>
> I am not sure if that will actually work, because the class is defined to
> be in the org.myorg package. I suggest you repackage to reflect the right
> package structure.
>
> Also, the error you are getting seems to indicate that you aphave compiled
> using Jdk 7. Note that some versions of Hadoop are supported only on Jdk 6.
> Which version of Hadoop are you using.
>
> Thanks
> Hemanth
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> Thank you very much.
> When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
> following error:
>
> [hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
> wordcount_classes.org.myorg.WordCount
> /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>         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)
>
>
>
> On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <
> yhemanth@thoughtworks.com> wrote:
>
> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run Wor
>
>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
Thats because the error is not related to the packaging. As mentioned in my
last mail, downgrade the java version used for compiling your code from Jdk
7 to Jdk 6. If you are using an IDE, it will have an option to set the
target compilation version. Google will help.


On Tuesday, February 19, 2013, Fatih Haltas wrote:

> Yes i reorganized the packages but still i am getting same error my hadoop
> version is 1.0.4
>
> 19 Şubat 2013 Salı tarihinde Hemanth Yamijala adlı kullanıcı şöyle yazdı:
>
> I am not sure if that will actually work, because the class is defined to
> be in the org.myorg package. I suggest you repackage to reflect the right
> package structure.
>
> Also, the error you are getting seems to indicate that you aphave compiled
> using Jdk 7. Note that some versions of Hadoop are supported only on Jdk 6.
> Which version of Hadoop are you using.
>
> Thanks
> Hemanth
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> Thank you very much.
> When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
> following error:
>
> [hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
> wordcount_classes.org.myorg.WordCount
> /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>         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)
>
>
>
> On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <
> yhemanth@thoughtworks.com> wrote:
>
> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run Wor
>
>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
Thats because the error is not related to the packaging. As mentioned in my
last mail, downgrade the java version used for compiling your code from Jdk
7 to Jdk 6. If you are using an IDE, it will have an option to set the
target compilation version. Google will help.


On Tuesday, February 19, 2013, Fatih Haltas wrote:

> Yes i reorganized the packages but still i am getting same error my hadoop
> version is 1.0.4
>
> 19 Şubat 2013 Salı tarihinde Hemanth Yamijala adlı kullanıcı şöyle yazdı:
>
> I am not sure if that will actually work, because the class is defined to
> be in the org.myorg package. I suggest you repackage to reflect the right
> package structure.
>
> Also, the error you are getting seems to indicate that you aphave compiled
> using Jdk 7. Note that some versions of Hadoop are supported only on Jdk 6.
> Which version of Hadoop are you using.
>
> Thanks
> Hemanth
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> Thank you very much.
> When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
> following error:
>
> [hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
> wordcount_classes.org.myorg.WordCount
> /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>         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)
>
>
>
> On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <
> yhemanth@thoughtworks.com> wrote:
>
> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run Wor
>
>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
Thats because the error is not related to the packaging. As mentioned in my
last mail, downgrade the java version used for compiling your code from Jdk
7 to Jdk 6. If you are using an IDE, it will have an option to set the
target compilation version. Google will help.


On Tuesday, February 19, 2013, Fatih Haltas wrote:

> Yes i reorganized the packages but still i am getting same error my hadoop
> version is 1.0.4
>
> 19 Şubat 2013 Salı tarihinde Hemanth Yamijala adlı kullanıcı şöyle yazdı:
>
> I am not sure if that will actually work, because the class is defined to
> be in the org.myorg package. I suggest you repackage to reflect the right
> package structure.
>
> Also, the error you are getting seems to indicate that you aphave compiled
> using Jdk 7. Note that some versions of Hadoop are supported only on Jdk 6.
> Which version of Hadoop are you using.
>
> Thanks
> Hemanth
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> Thank you very much.
> When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
> following error:
>
> [hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
> wordcount_classes.org.myorg.WordCount
> /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>         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)
>
>
>
> On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <
> yhemanth@thoughtworks.com> wrote:
>
> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run Wor
>
>

Re: ClassNotFoundException in Main

Posted by Fatih Haltas <fa...@nyu.edu>.
Yes i reorganized the packages but still i am getting same error my hadoop
version is 1.0.4

19 Şubat 2013 Salı tarihinde Hemanth Yamijala adlı kullanıcı şöyle yazdı:

> I am not sure if that will actually work, because the class is defined to
> be in the org.myorg package. I suggest you repackage to reflect the right
> package structure.
>
> Also, the error you are getting seems to indicate that you aphave compiled
> using Jdk 7. Note that some versions of Hadoop are supported only on Jdk 6.
> Which version of Hadoop are you using.
>
> Thanks
> Hemanth
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> Thank you very much.
> When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
> following error:
>
> [hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
> wordcount_classes.org.myorg.WordCount
> /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>         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)
>
>
>
> On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <
> yhemanth@thoughtworks.com> wrote:
>
> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run
> WordCount example.
> 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;"
>
>

Re: ClassNotFoundException in Main

Posted by Fatih Haltas <fa...@nyu.edu>.
Yes i reorganized the packages but still i am getting same error my hadoop
version is 1.0.4

19 Şubat 2013 Salı tarihinde Hemanth Yamijala adlı kullanıcı şöyle yazdı:

> I am not sure if that will actually work, because the class is defined to
> be in the org.myorg package. I suggest you repackage to reflect the right
> package structure.
>
> Also, the error you are getting seems to indicate that you aphave compiled
> using Jdk 7. Note that some versions of Hadoop are supported only on Jdk 6.
> Which version of Hadoop are you using.
>
> Thanks
> Hemanth
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> Thank you very much.
> When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
> following error:
>
> [hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
> wordcount_classes.org.myorg.WordCount
> /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>         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)
>
>
>
> On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <
> yhemanth@thoughtworks.com> wrote:
>
> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run
> WordCount example.
> 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;"
>
>

Re: ClassNotFoundException in Main

Posted by Fatih Haltas <fa...@nyu.edu>.
Yes i reorganized the packages but still i am getting same error my hadoop
version is 1.0.4

19 Şubat 2013 Salı tarihinde Hemanth Yamijala adlı kullanıcı şöyle yazdı:

> I am not sure if that will actually work, because the class is defined to
> be in the org.myorg package. I suggest you repackage to reflect the right
> package structure.
>
> Also, the error you are getting seems to indicate that you aphave compiled
> using Jdk 7. Note that some versions of Hadoop are supported only on Jdk 6.
> Which version of Hadoop are you using.
>
> Thanks
> Hemanth
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> Thank you very much.
> When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
> following error:
>
> [hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
> wordcount_classes.org.myorg.WordCount
> /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>         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)
>
>
>
> On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <
> yhemanth@thoughtworks.com> wrote:
>
> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run
> WordCount example.
> 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;"
>
>

Re: ClassNotFoundException in Main

Posted by Fatih Haltas <fa...@nyu.edu>.
Yes i reorganized the packages but still i am getting same error my hadoop
version is 1.0.4

19 Şubat 2013 Salı tarihinde Hemanth Yamijala adlı kullanıcı şöyle yazdı:

> I am not sure if that will actually work, because the class is defined to
> be in the org.myorg package. I suggest you repackage to reflect the right
> package structure.
>
> Also, the error you are getting seems to indicate that you aphave compiled
> using Jdk 7. Note that some versions of Hadoop are supported only on Jdk 6.
> Which version of Hadoop are you using.
>
> Thanks
> Hemanth
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> Thank you very much.
> When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
> following error:
>
> [hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
> wordcount_classes.org.myorg.WordCount
> /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>         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)
>
>
>
> On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <
> yhemanth@thoughtworks.com> wrote:
>
> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run
> WordCount example.
> 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;"
>
>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
I am not sure if that will actually work, because the class is defined to
be in the org.myorg package. I suggest you repackage to reflect the right
package structure.

Also, the error you are getting seems to indicate that you aphave compiled
using Jdk 7. Note that some versions of Hadoop are supported only on Jdk 6.
Which version of Hadoop are you using.

Thanks
Hemanth

On Tuesday, February 19, 2013, Fatih Haltas wrote:

> Thank you very much.
> When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
> following error:
>
> [hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
> wordcount_classes.org.myorg.WordCount
> /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>         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)
>
>
>
> On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <
> yhemanth@thoughtworks.com> wrote:
>
> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run
> WordCount example.
> 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
> 19_02_wordcount.output
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.ClassNotFoundException:
> org.myorg.WordCount
>         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
> META-INF/
> META-INF/MANIFEST.MF
> wordcount_classes/
> wordcount_classes/org/
> wordcount_classes/org/myorg/
> wordcount_classes/org/myorg/WordCount.class
> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
> **********************************************************
> 5. This is the 'ls' output of my working directory:
> *******************************************************
>
>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
I am not sure if that will actually work, because the class is defined to
be in the org.myorg package. I suggest you repackage to reflect the right
package structure.

Also, the error you are getting seems to indicate that you aphave compiled
using Jdk 7. Note that some versions of Hadoop are supported only on Jdk 6.
Which version of Hadoop are you using.

Thanks
Hemanth

On Tuesday, February 19, 2013, Fatih Haltas wrote:

> Thank you very much.
> When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
> following error:
>
> [hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
> wordcount_classes.org.myorg.WordCount
> /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>         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)
>
>
>
> On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <
> yhemanth@thoughtworks.com> wrote:
>
> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run
> WordCount example.
> 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
> 19_02_wordcount.output
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.ClassNotFoundException:
> org.myorg.WordCount
>         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
> META-INF/
> META-INF/MANIFEST.MF
> wordcount_classes/
> wordcount_classes/org/
> wordcount_classes/org/myorg/
> wordcount_classes/org/myorg/WordCount.class
> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
> **********************************************************
> 5. This is the 'ls' output of my working directory:
> *******************************************************
>
>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
I am not sure if that will actually work, because the class is defined to
be in the org.myorg package. I suggest you repackage to reflect the right
package structure.

Also, the error you are getting seems to indicate that you aphave compiled
using Jdk 7. Note that some versions of Hadoop are supported only on Jdk 6.
Which version of Hadoop are you using.

Thanks
Hemanth

On Tuesday, February 19, 2013, Fatih Haltas wrote:

> Thank you very much.
> When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
> following error:
>
> [hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
> wordcount_classes.org.myorg.WordCount
> /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>         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)
>
>
>
> On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <
> yhemanth@thoughtworks.com> wrote:
>
> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run
> WordCount example.
> 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
> 19_02_wordcount.output
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.ClassNotFoundException:
> org.myorg.WordCount
>         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
> META-INF/
> META-INF/MANIFEST.MF
> wordcount_classes/
> wordcount_classes/org/
> wordcount_classes/org/myorg/
> wordcount_classes/org/myorg/WordCount.class
> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
> **********************************************************
> 5. This is the 'ls' output of my working directory:
> *******************************************************
>
>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
I am not sure if that will actually work, because the class is defined to
be in the org.myorg package. I suggest you repackage to reflect the right
package structure.

Also, the error you are getting seems to indicate that you aphave compiled
using Jdk 7. Note that some versions of Hadoop are supported only on Jdk 6.
Which version of Hadoop are you using.

Thanks
Hemanth

On Tuesday, February 19, 2013, Fatih Haltas wrote:

> Thank you very much.
> When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
> following error:
>
> [hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
> wordcount_classes.org.myorg.WordCount
> /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>         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)
>
>
>
> On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <
> yhemanth@thoughtworks.com> wrote:
>
> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run
> WordCount example.
> 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
> 19_02_wordcount.output
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.ClassNotFoundException:
> org.myorg.WordCount
>         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
> META-INF/
> META-INF/MANIFEST.MF
> wordcount_classes/
> wordcount_classes/org/
> wordcount_classes/org/myorg/
> wordcount_classes/org/myorg/WordCount.class
> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
> **********************************************************
> 5. This is the 'ls' output of my working directory:
> *******************************************************
>
>

Re: ClassNotFoundException in Main

Posted by Fatih Haltas <fa...@nyu.edu>.
Thank you very much.
When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
following error:

[hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
wordcount_classes.org.myorg.WordCount
/home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
Warning: $HADOOP_HOME is deprecated.

Exception in thread "main" java.lang.UnsupportedClassVersionError:
wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
        at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
        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)



On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <yhemanth@thoughtworks.com
> wrote:

> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
>> Have you used the Api setJarByClass in your main program?
>>
>>
>> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>>
>> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>>
>>> 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 problem.
>>>
>>> To check, is there something wrong with my system, i tried to run
>>> WordCount example.
>>> 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
>>> 19_02_wordcount.output
>>> Warning: $HADOOP_HOME is deprecated.
>>>
>>> Exception in thread "main" java.lang.ClassNotFoundException:
>>> org.myorg.WordCount
>>>         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
>>> META-INF/
>>> META-INF/MANIFEST.MF
>>> wordcount_classes/
>>> wordcount_classes/org/
>>> wordcount_classes/org/myorg/
>>> wordcount_classes/org/myorg/WordCount.class
>>> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
>>> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
>>> **********************************************************
>>> 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
>>>
>>> Regards,
>>>
>>>
>>>

Re: ClassNotFoundException in Main

Posted by Fatih Haltas <fa...@nyu.edu>.
Thank you very much.
When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
following error:

[hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
wordcount_classes.org.myorg.WordCount
/home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
Warning: $HADOOP_HOME is deprecated.

Exception in thread "main" java.lang.UnsupportedClassVersionError:
wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
        at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
        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)



On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <yhemanth@thoughtworks.com
> wrote:

> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
>> Have you used the Api setJarByClass in your main program?
>>
>>
>> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>>
>> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>>
>>> 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 problem.
>>>
>>> To check, is there something wrong with my system, i tried to run
>>> WordCount example.
>>> 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
>>> 19_02_wordcount.output
>>> Warning: $HADOOP_HOME is deprecated.
>>>
>>> Exception in thread "main" java.lang.ClassNotFoundException:
>>> org.myorg.WordCount
>>>         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
>>> META-INF/
>>> META-INF/MANIFEST.MF
>>> wordcount_classes/
>>> wordcount_classes/org/
>>> wordcount_classes/org/myorg/
>>> wordcount_classes/org/myorg/WordCount.class
>>> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
>>> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
>>> **********************************************************
>>> 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
>>>
>>> Regards,
>>>
>>>
>>>

Re: ClassNotFoundException in Main

Posted by Fatih Haltas <fa...@nyu.edu>.
Thank you very much.
When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
following error:

[hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
wordcount_classes.org.myorg.WordCount
/home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
Warning: $HADOOP_HOME is deprecated.

Exception in thread "main" java.lang.UnsupportedClassVersionError:
wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
        at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
        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)



On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <yhemanth@thoughtworks.com
> wrote:

> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
>> Have you used the Api setJarByClass in your main program?
>>
>>
>> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>>
>> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>>
>>> 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 problem.
>>>
>>> To check, is there something wrong with my system, i tried to run
>>> WordCount example.
>>> 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
>>> 19_02_wordcount.output
>>> Warning: $HADOOP_HOME is deprecated.
>>>
>>> Exception in thread "main" java.lang.ClassNotFoundException:
>>> org.myorg.WordCount
>>>         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
>>> META-INF/
>>> META-INF/MANIFEST.MF
>>> wordcount_classes/
>>> wordcount_classes/org/
>>> wordcount_classes/org/myorg/
>>> wordcount_classes/org/myorg/WordCount.class
>>> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
>>> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
>>> **********************************************************
>>> 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
>>>
>>> Regards,
>>>
>>>
>>>

Re: ClassNotFoundException in Main

Posted by Fatih Haltas <fa...@nyu.edu>.
Thank you very much.
When i tried with wordcount_classes.org.myorg.WordCount, I am getting the
following error:

[hadoop@ADUAE042-LAP-V project]$ hadoop jar wordcount_19_02.jar
wordcount_classes.org.myorg.WordCount
/home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out
Warning: $HADOOP_HOME is deprecated.

Exception in thread "main" java.lang.UnsupportedClassVersionError:
wordcount_classes/org/myorg/WordCount : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
        at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
        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)



On Tue, Feb 19, 2013 at 8:10 PM, Hemanth Yamijala <yhemanth@thoughtworks.com
> wrote:

> Sorry. I did not read the mail correctly. I think the error is in how the
> jar has been created. The classes start with root as wordcount_classes,
> instead of org.
>
> Thanks
> Hemanth
>
>
> On Tuesday, February 19, 2013, Hemanth Yamijala wrote:
>
>> Have you used the Api setJarByClass in your main program?
>>
>>
>> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>>
>> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>>
>>> 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 problem.
>>>
>>> To check, is there something wrong with my system, i tried to run
>>> WordCount example.
>>> 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
>>> 19_02_wordcount.output
>>> Warning: $HADOOP_HOME is deprecated.
>>>
>>> Exception in thread "main" java.lang.ClassNotFoundException:
>>> org.myorg.WordCount
>>>         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
>>> META-INF/
>>> META-INF/MANIFEST.MF
>>> wordcount_classes/
>>> wordcount_classes/org/
>>> wordcount_classes/org/myorg/
>>> wordcount_classes/org/myorg/WordCount.class
>>> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
>>> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
>>> **********************************************************
>>> 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
>>>
>>> Regards,
>>>
>>>
>>>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
Sorry. I did not read the mail correctly. I think the error is in how the
jar has been created. The classes start with root as wordcount_classes,
instead of org.

Thanks
Hemanth

On Tuesday, February 19, 2013, Hemanth Yamijala wrote:

> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
>> 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 problem.
>>
>> To check, is there something wrong with my system, i tried to run
>> WordCount example.
>> 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
>> 19_02_wordcount.output
>> Warning: $HADOOP_HOME is deprecated.
>>
>> Exception in thread "main" java.lang.ClassNotFoundException:
>> org.myorg.WordCount
>>         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
>> META-INF/
>> META-INF/MANIFEST.MF
>> wordcount_classes/
>> wordcount_classes/org/
>> wordcount_classes/org/myorg/
>> wordcount_classes/org/myorg/WordCount.class
>> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
>> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
>> **********************************************************
>> 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
>>
>> Regards,
>>
>>
>>

Re: ClassNotFoundException in Main

Posted by Fatih Haltas <fa...@nyu.edu>.
Thanks Hemanth for your reply.

Unfortunately, I used in mycode. Also to control my system I tried to run
Wordcount example of apache.hadoop itself by just changing the package
info, this one also did not work


On Tue, Feb 19, 2013 at 8:02 PM, Hemanth Yamijala <yhemanth@thoughtworks.com
> wrote:

> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
>> 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 problem.
>>
>> To check, is there something wrong with my system, i tried to run
>> WordCount example.
>> 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
>> 19_02_wordcount.output
>> Warning: $HADOOP_HOME is deprecated.
>>
>> Exception in thread "main" java.lang.ClassNotFoundException:
>> org.myorg.WordCount
>>         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
>> META-INF/
>> META-INF/MANIFEST.MF
>> wordcount_classes/
>> wordcount_classes/org/
>> wordcount_classes/org/myorg/
>> wordcount_classes/org/myorg/WordCount.class
>> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
>> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
>> **********************************************************
>> 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
>>
>> Regards,
>>
>>
>>

Re: ClassNotFoundException in Main

Posted by Fatih Haltas <fa...@nyu.edu>.
Thanks Hemanth for your reply.

Unfortunately, I used in mycode. Also to control my system I tried to run
Wordcount example of apache.hadoop itself by just changing the package
info, this one also did not work


On Tue, Feb 19, 2013 at 8:02 PM, Hemanth Yamijala <yhemanth@thoughtworks.com
> wrote:

> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
>> 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 problem.
>>
>> To check, is there something wrong with my system, i tried to run
>> WordCount example.
>> 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
>> 19_02_wordcount.output
>> Warning: $HADOOP_HOME is deprecated.
>>
>> Exception in thread "main" java.lang.ClassNotFoundException:
>> org.myorg.WordCount
>>         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
>> META-INF/
>> META-INF/MANIFEST.MF
>> wordcount_classes/
>> wordcount_classes/org/
>> wordcount_classes/org/myorg/
>> wordcount_classes/org/myorg/WordCount.class
>> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
>> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
>> **********************************************************
>> 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
>>
>> Regards,
>>
>>
>>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
Sorry. I did not read the mail correctly. I think the error is in how the
jar has been created. The classes start with root as wordcount_classes,
instead of org.

Thanks
Hemanth

On Tuesday, February 19, 2013, Hemanth Yamijala wrote:

> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
>> 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 problem.
>>
>> To check, is there something wrong with my system, i tried to run
>> WordCount example.
>> 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
>> 19_02_wordcount.output
>> Warning: $HADOOP_HOME is deprecated.
>>
>> Exception in thread "main" java.lang.ClassNotFoundException:
>> org.myorg.WordCount
>>         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
>> META-INF/
>> META-INF/MANIFEST.MF
>> wordcount_classes/
>> wordcount_classes/org/
>> wordcount_classes/org/myorg/
>> wordcount_classes/org/myorg/WordCount.class
>> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
>> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
>> **********************************************************
>> 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
>>
>> Regards,
>>
>>
>>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
Sorry. I did not read the mail correctly. I think the error is in how the
jar has been created. The classes start with root as wordcount_classes,
instead of org.

Thanks
Hemanth

On Tuesday, February 19, 2013, Hemanth Yamijala wrote:

> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
>> 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 problem.
>>
>> To check, is there something wrong with my system, i tried to run
>> WordCount example.
>> 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
>> 19_02_wordcount.output
>> Warning: $HADOOP_HOME is deprecated.
>>
>> Exception in thread "main" java.lang.ClassNotFoundException:
>> org.myorg.WordCount
>>         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
>> META-INF/
>> META-INF/MANIFEST.MF
>> wordcount_classes/
>> wordcount_classes/org/
>> wordcount_classes/org/myorg/
>> wordcount_classes/org/myorg/WordCount.class
>> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
>> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
>> **********************************************************
>> 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
>>
>> Regards,
>>
>>
>>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
Sorry. I did not read the mail correctly. I think the error is in how the
jar has been created. The classes start with root as wordcount_classes,
instead of org.

Thanks
Hemanth

On Tuesday, February 19, 2013, Hemanth Yamijala wrote:

> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
>> 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 problem.
>>
>> To check, is there something wrong with my system, i tried to run
>> WordCount example.
>> 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
>> 19_02_wordcount.output
>> Warning: $HADOOP_HOME is deprecated.
>>
>> Exception in thread "main" java.lang.ClassNotFoundException:
>> org.myorg.WordCount
>>         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
>> META-INF/
>> META-INF/MANIFEST.MF
>> wordcount_classes/
>> wordcount_classes/org/
>> wordcount_classes/org/myorg/
>> wordcount_classes/org/myorg/WordCount.class
>> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
>> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
>> **********************************************************
>> 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
>>
>> Regards,
>>
>>
>>

Re: ClassNotFoundException in Main

Posted by Fatih Haltas <fa...@nyu.edu>.
Thanks Hemanth for your reply.

Unfortunately, I used in mycode. Also to control my system I tried to run
Wordcount example of apache.hadoop itself by just changing the package
info, this one also did not work


On Tue, Feb 19, 2013 at 8:02 PM, Hemanth Yamijala <yhemanth@thoughtworks.com
> wrote:

> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
>> 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 problem.
>>
>> To check, is there something wrong with my system, i tried to run
>> WordCount example.
>> 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
>> 19_02_wordcount.output
>> Warning: $HADOOP_HOME is deprecated.
>>
>> Exception in thread "main" java.lang.ClassNotFoundException:
>> org.myorg.WordCount
>>         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
>> META-INF/
>> META-INF/MANIFEST.MF
>> wordcount_classes/
>> wordcount_classes/org/
>> wordcount_classes/org/myorg/
>> wordcount_classes/org/myorg/WordCount.class
>> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
>> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
>> **********************************************************
>> 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
>>
>> Regards,
>>
>>
>>

Re: ClassNotFoundException in Main

Posted by Fatih Haltas <fa...@nyu.edu>.
Thanks Hemanth for your reply.

Unfortunately, I used in mycode. Also to control my system I tried to run
Wordcount example of apache.hadoop itself by just changing the package
info, this one also did not work


On Tue, Feb 19, 2013 at 8:02 PM, Hemanth Yamijala <yhemanth@thoughtworks.com
> wrote:

> Have you used the Api setJarByClass in your main program?
>
>
> http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)
>
>
> On Tuesday, February 19, 2013, Fatih Haltas wrote:
>
>> 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 problem.
>>
>> To check, is there something wrong with my system, i tried to run
>> WordCount example.
>> 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
>> 19_02_wordcount.output
>> Warning: $HADOOP_HOME is deprecated.
>>
>> Exception in thread "main" java.lang.ClassNotFoundException:
>> org.myorg.WordCount
>>         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
>> META-INF/
>> META-INF/MANIFEST.MF
>> wordcount_classes/
>> wordcount_classes/org/
>> wordcount_classes/org/myorg/
>> wordcount_classes/org/myorg/WordCount.class
>> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
>> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
>> **********************************************************
>> 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
>>
>> Regards,
>>
>>
>>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
Have you used the Api setJarByClass in your main program?

http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)

On Tuesday, February 19, 2013, Fatih Haltas wrote:

> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run
> WordCount example.
> 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
> 19_02_wordcount.output
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.ClassNotFoundException:
> org.myorg.WordCount
>         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
> META-INF/
> META-INF/MANIFEST.MF
> wordcount_classes/
> wordcount_classes/org/
> wordcount_classes/org/myorg/
> wordcount_classes/org/myorg/WordCount.class
> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
> **********************************************************
> 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
>
> Regards,
>
>
>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
Have you used the Api setJarByClass in your main program?

http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)

On Tuesday, February 19, 2013, Fatih Haltas wrote:

> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run
> WordCount example.
> 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
> 19_02_wordcount.output
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.ClassNotFoundException:
> org.myorg.WordCount
>         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
> META-INF/
> META-INF/MANIFEST.MF
> wordcount_classes/
> wordcount_classes/org/
> wordcount_classes/org/myorg/
> wordcount_classes/org/myorg/WordCount.class
> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
> **********************************************************
> 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
>
> Regards,
>
>
>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
Have you used the Api setJarByClass in your main program?

http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)

On Tuesday, February 19, 2013, Fatih Haltas wrote:

> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run
> WordCount example.
> 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
> 19_02_wordcount.output
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.ClassNotFoundException:
> org.myorg.WordCount
>         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
> META-INF/
> META-INF/MANIFEST.MF
> wordcount_classes/
> wordcount_classes/org/
> wordcount_classes/org/myorg/
> wordcount_classes/org/myorg/WordCount.class
> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
> **********************************************************
> 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
>
> Regards,
>
>
>

Re: ClassNotFoundException in Main

Posted by Hemanth Yamijala <yh...@thoughtworks.com>.
Have you used the Api setJarByClass in your main program?

http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Job.html#setJarByClass(java.lang.Class)

On Tuesday, February 19, 2013, Fatih Haltas wrote:

> 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
> problem.
>
> To check, is there something wrong with my system, i tried to run
> WordCount example.
> 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
> 19_02_wordcount.output
> Warning: $HADOOP_HOME is deprecated.
>
> Exception in thread "main" java.lang.ClassNotFoundException:
> org.myorg.WordCount
>         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
> META-INF/
> META-INF/MANIFEST.MF
> wordcount_classes/
> wordcount_classes/org/
> wordcount_classes/org/myorg/
> wordcount_classes/org/myorg/WordCount.class
> wordcount_classes/org/myorg/WordCount$TokenizerMapper.class
> wordcount_classes/org/myorg/WordCount$IntSumReducer.class
> **********************************************************
> 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
>
> Regards,
>
>
>