Return-Path: X-Original-To: apmail-hadoop-common-user-archive@www.apache.org Delivered-To: apmail-hadoop-common-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1B72BE84F for ; Tue, 19 Feb 2013 16:40:39 +0000 (UTC) Received: (qmail 50134 invoked by uid 500); 19 Feb 2013 16:40:34 -0000 Delivered-To: apmail-hadoop-common-user-archive@hadoop.apache.org Received: (qmail 50013 invoked by uid 500); 19 Feb 2013 16:40:33 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 50006 invoked by uid 99); 19 Feb 2013 16:40:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2013 16:40:33 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of hemanty@thoughtworks.com designates 64.18.0.143 as permitted sender) Received: from [64.18.0.143] (HELO exprod5og102.obsmtp.com) (64.18.0.143) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2013 16:40:27 +0000 Received: from mail-ie0-f198.google.com ([209.85.223.198]) (using TLSv1) by exprod5ob102.postini.com ([64.18.4.12]) with SMTP ID DSNKUSOq5ALCGIqYejHIBHyh/hF4xZ1Xzq7d@postini.com; Tue, 19 Feb 2013 08:40:04 PST Received: by mail-ie0-f198.google.com with SMTP id 17so33297204iea.1 for ; Tue, 19 Feb 2013 08:40:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-received:in-reply-to:references:date :message-id:subject:from:to:content-type:x-gm-message-state; bh=KUL012DOneYCr4YW0n4bOHMWLjU0uwVREKGrodQDlAg=; b=dDxKGvJZwK65pVFmrspVJyZOAM1uJ4hyBhvqvU9zwy1LwaPLzx3aNCLL0T6cfjpvPj JYiARzRyJ4XGUC4joDCgaFiMh9sCN1cI5Q/EBH/EicuDTIDQ3SioLTxS5kCfO0fEamOS csdQRE2fyQni4Pekz2nE71e6P9hVCmPyUlvkz2cmYgdeM53j/cgN6mnZXNgRMPqIuoXH 4sWekdAx2IJejFVEhXRZH6jhCfqiv1oqbb5f6qafIqPZ45WkjPYlCcRvG5Cb3l8KW37V ODSXJBsqctHguUA1t9SuVd+YpPJXPIgzzyE3lWPLwum23cUXVHcZVCSzyK8gYEl2d73L sJ0A== X-Received: by 10.182.54.46 with SMTP id g14mr7689010obp.55.1361292003930; Tue, 19 Feb 2013 08:40:03 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.182.54.46 with SMTP id g14mr7689007obp.55.1361292003798; Tue, 19 Feb 2013 08:40:03 -0800 (PST) Received: by 10.76.22.45 with HTTP; Tue, 19 Feb 2013 08:40:03 -0800 (PST) In-Reply-To: References: Date: Tue, 19 Feb 2013 22:10:03 +0530 Message-ID: Subject: Re: ClassNotFoundException in Main From: Hemanth Yamijala To: "user@hadoop.apache.org" Content-Type: multipart/alternative; boundary=14dae93b57be526d4704d6167ea2 X-Gm-Message-State: ALoCoQmdLZU/qPdvlMCoDzEhycEeTHlHTI4a1vto3oZR1XEs5EnSWfNJHOrpYq1BmssPmhXvKGqUZCgI0sNKa/KeehsZAMlwBUkqxbFViRT4raHiNHoPnOmyK99vobV86554ClgtVIgH+ugBOUp3wFTHzaJxEuWmAg== X-Virus-Checked: Checked by ClamAV on apache.org --14dae93b57be526d4704d6167ea2 Content-Type: text/plain; charset=ISO-8859-1 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: > ******************************************************* > > --14dae93b57be526d4704d6167ea2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I am not sure if that will actually work, because the class is defined to b= e in the org.myorg package. I suggest you repackage to reflect the right pa= ckage structure.=A0

Also, the error you are getting seem= s 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 usi= ng.

Thanks
Hemanth=A0

On Tues= day, February 19, 2013, Fatih Haltas wrote:
Thank you very much.=A0
When i tried with=A0wordcount_classes.org.myo= rg.WordCount, I am getting the following error:

[hadoop@ADUAE042-LA= P-V project]$ hadoop jar wordcount_19_02.jar wordcount_classes.org.myorg.Wo= rdCount /home/hadoop/project/hadoop-data/NetFlow 19_02_wordcount.out=
Warning: $HADOOP_HOME is deprecated.<= /font>

Exception in thread "main" java.lan= g.UnsupportedClassVersionError: wordcount_classes/org/myorg/WordCount : Uns= upported major.minor version 51.0
=A0 =A0 =A0 =A0 at java.lang.ClassLoa= der.defineClass1(Native Method)
=A0 =A0 =A0 =A0 at java.lang.ClassLoader.defineClass(ClassLoader.jav= a:634)
=A0 =A0 =A0 =A0 at java.security.Secu= reClassLoader.defineClass(SecureClassLoader.java:142)
=A0 =A0 =A0 =A0 at java.net.URLClassLoader.def= ineClass(URLClassLoader.java:277)
=A0 =A0 =A0 =A0 at java.net.URLClassL= oader.access$000(URLClassLoader.java:73)
=A0 =A0 =A0 =A0 at java.net.URLClassLoader$1.run(URLClassLo= ader.java:212)
=A0 =A0 =A0 =A0 at java.security.Acce= ssController.doPrivileged(Native Method)
=A0 =A0 =A0 =A0 at java.net.URLClassLoader.findClass(URLCla= ssLoader.java:205)
=A0 =A0 =A0 =A0 at java.lang.ClassLoa= der.loadClass(ClassLoader.java:321)
=A0 =A0 =A0 =A0 at java.lang.ClassLoader.loadClass(ClassLoader.j= ava:266)
=A0 =A0 =A0 =A0 at java.lang.Class.fo= rName0(Native Method)
=A0= =A0 =A0 =A0 at java.lang.Class.forName(Class.java:266)
=A0 =A0 =A0 =A0 at org.apache.hadoop.util.Ru= nJar.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 ha= s been created. The classes start with root as wordcount_classes, instead o= f 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/Jo= b.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.<= /div>

What may be the reason for it? I have been struggling f= or this problem more than a 2 days.=A0
I just wrote different Map= Reduce application for some anlaysis. I got this problem.

To check, is there something wrong with my system, i tr= ied to run WordCount example.
When I just run hadoop-examples wor= dcount, it is working fine.=A0

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

Here is what I have done s= o far
***********************************************************= **************
1. I just copied wordcount code from the apaches own examples source c= ode and I just changed package decleration as "package org.myorg;"= ;
***************************************************************= ***********
2. Then I tried to run that command:
=A0********************= *****************************************************
"hadoo= p jar wordcount_19_02.jar org.myorg.WordCount /home/hadoop/project/hadoop-d= ata/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_word= count.output
Warning: $HADOOP_HOME is deprecated.

Exception in thread "main" java.lang.ClassNot= FoundException: org.myorg.WordCount
=A0 =A0 =A0 =A0 at java.net.U= RLClassLoader$1.run(URLClassLoader.java:217)
=A0 =A0 =A0 =A0 at j= ava.security.AccessController.doPrivileged(Native Method)
=A0 =A0 =A0 =A0 at java.net.URLClassLoader.findClass(URLClassLoader.ja= va:205)
=A0 =A0 =A0 =A0 at java.lang.ClassLoader.loadClass(ClassL= oader.java:321)
=A0 =A0 =A0 =A0 at java.lang.ClassLoader.loadClas= s(ClassLoader.java:266)
=A0 =A0 =A0 =A0 at java.lang.Class.forName0(Native Method)
= =A0 =A0 =A0 =A0 at java.lang.Class.forName(Class.java:266)
=A0 = =A0 =A0 =A0 at org.apache.hadoop.util.RunJar.main(RunJar.java:149)

**************************************************************************<= /div>
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/myor= g/WordCount$IntSumReducer.class
*********************************= *************************
5. This is the 'ls' output of my working directory= :
*******************************************************
--14dae93b57be526d4704d6167ea2--