hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Varun Thacker <varunthacker1...@gmail.com>
Subject Re: some doubts
Date Sat, 06 Mar 2010 06:25:04 GMT
hadoop@varun:~/hadoop-0.20.1$ bin/hadoop jar Election.jar Election gutenberg
gutenberg-output
Exception in thread "main" java.lang.NoClassDefFoundError: Election (wrong
name: Election/Election)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:149)


On Sat, Mar 6, 2010 at 3:06 AM, Jones, Nick <nick.jones@amd.com> wrote:

> Try one more time but with:
> bin/hadoop jar Election.jar Election gutenberg gutenberg-output
>
> -----Original Message-----
> From: Varun Thacker [mailto:varunthacker1989@gmail.com]
> Sent: Friday, March 05, 2010 3:19 PM
> To: common-user@hadoop.apache.org
> Subject: Re: some doubts
>
> I tried out one more thing .i rebuilt the jar file and removed the
> Election.java(I thought it might cause some name colision)
>
> Still i got an error.This is different.
>
> hadoop@varun:~/hadoop-0.20.1$ bin/hadoop jar Election.jar Election.jar
> gutenberg gutenberg-output
> Exception in thread "main" java.lang.ClassNotFoundException: Election.jar
>    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>    at java.security.AccessController.doPrivileged(Native Method)
>    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>    at java.lang.Class.forName0(Native Method)
>    at java.lang.Class.forName(Class.java:247)
>    at org.apache.hadoop.util.RunJar.main(RunJar.java:149)
>
>
> On Sat, Mar 6, 2010 at 2:20 AM, Varun Thacker <varunthacker1989@gmail.com
> >wrote:
>
> > this time i ran it without the .class .This is what error i get
> >
> > hadoop@varun:~/hadoop-0.20.1$ bin/hadoop jar Election.jar Election
> > gutenberg gutenberg-output
> > Exception in thread "main" java.lang.NoClassDefFoundError: Election
> (wrong
> > name: Election/Election)
> >     at java.lang.ClassLoader.defineClass1(Native Method)
> >     at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
> >     at
> > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
> >     at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
> >     at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
> >     at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> >
> >     at java.security.AccessController.doPrivileged(Native Method)
> >     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> >     at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> >     at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> >     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> >     at java.lang.Class.forName0(Native Method)
> >     at java.lang.Class.forName(Class.java:247)
> >     at org.apache.hadoop.util.RunJar.main(RunJar.java:149)
> >
> >
> > On Sat, Mar 6, 2010 at 1:37 AM, Nick Jones <nick.jones@amd.com> wrote:
> >
> >> I missed a subtle error on the command line.  The class shouldn't be
> >> referenced by the filename but just class name itself.  Change
> >> "Election.class" to "Election" when launching the job.
> >>
> >>
> >> On 03/05/2010 01:14 PM, Varun Thacker wrote:
> >>
> >>> This is how my jar looks like.
> >>> Its name is Election.jar
> >>>
> >>> Inside the jar these are the files
> >>>
> >>> Election.java
> >>> Election.class
> >>> Election$Reduce.class
> >>> Election$Map.class
> >>> META-INF/
> >>> Manifest-Version: 1.0
> >>>
> >>> So what is the package information in this case.
> >>>
> >>>
> >>> On Fri, Mar 5, 2010 at 7:32 PM, Jones, Nick<nick.jones@amd.com>
>  wrote:
> >>>
> >>>
> >>>
> >>>> The path to the class needs to include the package information. (i.e.
> >>>> com.mycompany.mytool.election)
> >>>>
> >>>> Nick Jones
> >>>> Sent by radiation.
> >>>>
> >>>> On Mar 5, 2010, at 7:27 AM, "Varun Thacker"
> >>>> <varunthacker1989@gmail.com>  wrote:
> >>>>
> >>>>
> >>>>
> >>>>> This is how my jar looks like.
> >>>>> Its name is Election.jar
> >>>>> Directory:hadoop@varun:~/hadoop-0.20.1
> >>>>> Inside the jar these are the files
> >>>>> Election.java
> >>>>> Election.class
> >>>>> Election$Reduce.class
> >>>>> Election$Map.class
> >>>>> META-INF/
> >>>>> Manifest-Version: 1.0
> >>>>> Created-By: 1.6.0_0 (Sun Microsystems Inc.)
> >>>>>
> >>>>> This is how i run it:
> >>>>> hadoop@varun:~/hadoop-0.20.1$ bin/hadoop jar Election.jar
> >>>>> Election.class
> >>>>> gutenberg gutenberg-output
> >>>>>
> >>>>> Exception in thread "main" java.lang.ClassNotFoundException:
> >>>>> Election.class
> >>>>>    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> >>>>>    at java.security.AccessController.doPrivileged(Native Method)
> >>>>>    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> >>>>>    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> >>>>>    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> >>>>>    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> >>>>>    at java.lang.Class.forName0(Native Method)
> >>>>>    at java.lang.Class.forName(Class.java:247)
> >>>>>    at org.apache.hadoop.util.RunJar.main(RunJar.java:149)
> >>>>>
> >>>>> what am doing wrong?
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Fri, Mar 5, 2010 at 10:40 AM, Eric Sammer<eric@lifeless.net>
> >>>>> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>> On 3/4/10 11:42 PM, Varun Thacker wrote:
> >>>>>>
> >>>>>>
> >>>>>>> I am using ubuntu Linux. I was able to get the standalone
hadoop
> >>>>>>> cluster
> >>>>>>> running and run the wordcount example.
> >>>>>>> before i start writing hadoop programs i wanted to compile
the
> >>>>>>> wordcount
> >>>>>>> example on my own.
> >>>>>>> So this is what i did to make the jar file on my own.
> >>>>>>>
> >>>>>>> javac -classpath /home/varun/hadoop/hadoop-0.
> >>>>>>> 20.1/hadoop-0.20.1-core.jar WordCount.java
> >>>>>>> jar -cvf wordcount.jar -C /media/d/iproggys/java/Hadoop/src/
> >>>>>>> wordcount/ .
> >>>>>>>
> >>>>>>> Is this the correct way to do it?
> >>>>>>>
> >>>>>>>
> >>>>>> That looks correct, yes. For anything more complicated than
> something
> >>>>>> like this, you'll want to use a build tool like Maven or Ant,
> though.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> I had one more doubt while running the example.This is what
i do
> >>>>>>> to run
> >>>>>>>
> >>>>>>>
> >>>>>> the
> >>>>>>
> >>>>>>
> >>>>>>> mapreduce job.
> >>>>>>> bin/hadoop jar hadoop-0.20.1-examples.jar wordcount gutenberg
> >>>>>>> gutenberg-output
> >>>>>>>
> >>>>>>> what is wordcount?
> >>>>>>> gutenberg being the input dir.
> >>>>>>> gutenberg-output being the out dir.
> >>>>>>>
> >>>>>>>
> >>>>>> The 'hadoop jar' command requires the jar file. The next argument
is
> >>>>>> usually the name of the class to run from the jar file. This
is not
> >>>>>> required if the jar's manifest file specifies it, though (which
the
> >>>>>> examples jar does). In this case, this is just a normal argument
> >>>>>> passed
> >>>>>> to the main method of the main class. Like you said, the other
> >>>>>> arguments
> >>>>>> are the input and output directories.
> >>>>>>
> >>>>>> If you unjar the examples and look at the manifest file, you'll
see
> >>>>>> the
> >>>>>> line:
> >>>>>> Main-Class: org/apache/hadoop/examples/ExampleDriver
> >>>>>>
> >>>>>> This is the class that gets run for this jar file.
> >>>>>>
> >>>>>> If you run 'hadoop jar' with no other arguments, you'll see
the
> usage
> >>>>>> statement:
> >>>>>>
> >>>>>> # $HADOOP_HOME/bin/hadoop jar
> >>>>>> RunJar jarFile [mainClass] args...
> >>>>>>
> >>>>>> If you run the example jar without the arguments, you'll see
the
> >>>>>> example
> >>>>>> code usage:
> >>>>>>
> >>>>>> # $HADOOP_HOME/bin/hadoop jar hadoop-0.20.1+152-examples.jar
> >>>>>> An example program must be given as the first argument.
> >>>>>> Valid program names are:
> >>>>>> aggregatewordcount: An Aggregate based map/reduce program that
> counts
> >>>>>> the words in the input files.
> >>>>>> aggregatewordhist: An Aggregate based map/reduce program that
> >>>>>> computes
> >>>>>> the histogram of the words in the input files.
> >>>>>> dbcount: An example job that count the pageview counts from
a
> >>>>>> database.
> >>>>>> grep: A map/reduce program that counts the matches of a regex
in the
> >>>>>> input.
> >>>>>> join: A job that effects a join over sorted, equally partitioned
> >>>>>> datasets
> >>>>>> multifilewc: A job that counts words from several files.
> >>>>>> pentomino: A map/reduce tile laying program to find solutions
to
> >>>>>> pentomino problems.
> >>>>>> pi: A map/reduce program that estimates Pi using monte-carlo
method.
> >>>>>> randomtextwriter: A map/reduce program that writes 10GB of random
> >>>>>> textual data per node.
> >>>>>> randomwriter: A map/reduce program that writes 10GB of random
data
> >>>>>> per
> >>>>>> node.
> >>>>>> secondarysort: An example defining a secondary sort to the reduce.
> >>>>>> sleep: A job that sleeps at each map and reduce task.
> >>>>>> sort: A map/reduce program that sorts the data written by the
random
> >>>>>> writer.
> >>>>>> sudoku: A sudoku solver.
> >>>>>> teragen: Generate data for the terasort
> >>>>>> terasort: Run the terasort
> >>>>>> teravalidate: Checking results of terasort
> >>>>>> wordcount: A map/reduce program that counts the words in the
input
> >>>>>> files.
> >>>>>>
> >>>>>> Note that 'wordcount' is one of the options.
> >>>>>>
> >>>>>> Hope this helps.
> >>>>>> --
> >>>>>> Eric Sammer
> >>>>>> eric@lifeless.net
> >>>>>> http://esammer.blogspot.com
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>>
> >>>>>
> >>>>> Regards,
> >>>>> Varun Thacker
> >>>>> http://varunthacker.wordpress.com
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
> > --
> >
> >
> > Regards,
> > Varun Thacker
> > http://varunthacker.wordpress.com
> >
> >
> >
>
>
> --
>
>
> Regards,
> Varun Thacker
> http://varunthacker.wordpress.com
>
>


-- 


Regards,
Varun Thacker
http://varunthacker.wordpress.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message