You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@hadoop.apache.org by james isaac <ja...@gmail.com> on 2010/07/12 14:15:18 UTC

Exception in thread "main" java.lang.ClassNotFoundException in Hadoop

Hi,

I have just started my career with Hadoop. I tried to execute the example
given in http://hadoop.apache.org/common/docs/r0.20.1/mapred_tutorial.htmlas
explained in the tutorial. I was not able to execute the program as
described in the tutorial. I am getting the error as shown below. I tried
executing with some other examples. They are also showing the same
“ClassNotFoundException”. I tried to find the solution in various websites
but i could not find it. Please help me to find the problem.

Exception in thread "main"
java.lang.ClassNotFoundException: org.myorg.WordCount
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)

Re: Exception in thread "main" java.lang.ClassNotFoundException in Hadoop

Posted by Ted Yu <yu...@gmail.com>.
I assume you have used jar command to confirm that org.myorg.WordCount is in
wordcount.jar

On Mon, Jul 12, 2010 at 10:59 PM, james isaac <ja...@gmail.com>wrote:

> This is the command i used and prompt is pointing to the current directory
> where wordcount.jar resides. I have also set the path for the HADOOP_HOME
> and added the bin directory of hadoop to the classpath.
>
> current directory = /home/user/demo/wordcount
> HADOOP_HOME=/home/user/hadoop_sws/hadoop-0.20.2
> $ hadoop jar wordcount.jar org.myorg.WordCount /hdfs/data/input
> /hdfs/data/output
>
>
>
> On Mon, Jul 12, 2010 at 9:14 PM, Ted Yu <yu...@gmail.com> wrote:
>
> > Please give the commandline you used.
> > You should have specified the jar containing WordCount class.
> >
> > On Mon, Jul 12, 2010 at 5:15 AM, james isaac <jamesisaac.dell@gmail.com
> > >wrote:
> >
> > > Hi,
> > >
> > > I have just started my career with Hadoop. I tried to execute the
> example
> > > given in
> > > http://hadoop.apache.org/common/docs/r0.20.1/mapred_tutorial.htmlas
> > > explained in the tutorial. I was not able to execute the program as
> > > described in the tutorial. I am getting the error as shown below. I
> tried
> > > executing with some other examples. They are also showing the same
> > > “ClassNotFoundException”. I tried to find the solution in various
> > websites
> > > but i could not find it. Please help me to find the problem.
> > >
> > > Exception in thread "main"
> > > java.lang.ClassNotFoundException: org.myorg.WordCount
> > > 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)
> > >
> >
>

Re: Exception in thread "main" java.lang.ClassNotFoundException in Hadoop

Posted by james isaac <ja...@gmail.com>.
This is the command i used and prompt is pointing to the current directory
where wordcount.jar resides. I have also set the path for the HADOOP_HOME
and added the bin directory of hadoop to the classpath.

current directory = /home/user/demo/wordcount
HADOOP_HOME=/home/user/hadoop_sws/hadoop-0.20.2
$ hadoop jar wordcount.jar org.myorg.WordCount /hdfs/data/input
/hdfs/data/output



On Mon, Jul 12, 2010 at 9:14 PM, Ted Yu <yu...@gmail.com> wrote:

> Please give the commandline you used.
> You should have specified the jar containing WordCount class.
>
> On Mon, Jul 12, 2010 at 5:15 AM, james isaac <jamesisaac.dell@gmail.com
> >wrote:
>
> > Hi,
> >
> > I have just started my career with Hadoop. I tried to execute the example
> > given in
> > http://hadoop.apache.org/common/docs/r0.20.1/mapred_tutorial.htmlas
> > explained in the tutorial. I was not able to execute the program as
> > described in the tutorial. I am getting the error as shown below. I tried
> > executing with some other examples. They are also showing the same
> > “ClassNotFoundException”. I tried to find the solution in various
> websites
> > but i could not find it. Please help me to find the problem.
> >
> > Exception in thread "main"
> > java.lang.ClassNotFoundException: org.myorg.WordCount
> > 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)
> >
>

Re: Exception in thread "main" java.lang.ClassNotFoundException in Hadoop

Posted by Ted Yu <yu...@gmail.com>.
Please give the commandline you used.
You should have specified the jar containing WordCount class.

On Mon, Jul 12, 2010 at 5:15 AM, james isaac <ja...@gmail.com>wrote:

> Hi,
>
> I have just started my career with Hadoop. I tried to execute the example
> given in
> http://hadoop.apache.org/common/docs/r0.20.1/mapred_tutorial.htmlas
> explained in the tutorial. I was not able to execute the program as
> described in the tutorial. I am getting the error as shown below. I tried
> executing with some other examples. They are also showing the same
> “ClassNotFoundException”. I tried to find the solution in various websites
> but i could not find it. Please help me to find the problem.
>
> Exception in thread "main"
> java.lang.ClassNotFoundException: org.myorg.WordCount
> 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)
>