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 Pramy Bhats <pr...@googlemail.com> on 2010/07/12 00:09:42 UTC

newly built Jar file

Hi,

I recently started playing with hadoop source code, when I compiled the
source code and built a new jar file using the class files in the build
folder.

However, when i tried to run the world count example using the new jar file
-- it gives me the following error. However, i didnt modify the source code
yet and if i run using the original jar file the program works fine.

I'd be grateful, if you could let me know what could be the problem for this
?

Error result



Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/hadoop/util/PlatformName
Caused by: java.lang.ClassNotFoundException:
org.apache.hadoop.util.PlatformName
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.apache.hadoop.util.PlatformName.  Program
will exit.
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/hadoop/util/RunJar
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.RunJar
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.apache.hadoop.util.RunJar.  Program will
exit.



thanks in advance,
--PB

Re: newly built Jar file

Posted by Pramy Bhats <pr...@googlemail.com>.
Hi Ted,

Thanks, the problem is solved using "ant jar".

Earlier, I was manually building the hadoop-*-core.jar using the following
command:

tar -cvf hadoop-*-core.jar build/classes


Now, after using the command:

ant jar

ant has built a jar file named hadoop-0.20.3-dev-core.jar

Using this jar file jobs run fine.

thanks,
--PB



On Mon, Jul 12, 2010 at 1:04 AM, Ted Yu <yu...@gmail.com> wrote:

> It should be in hadoop-core jar:
> tyumac:hadoop-0.20.2+320 tyu$ jar tvf
> build/hadoop-core-0.20.2-CDH3b2-SNAPSHOT.jar | grep PlatformName
>  1048 Fri Jul 02 11:31:04 PDT 2010
> org/apache/hadoop/util/PlatformName.class
>
> Did you use "ant jar" command to build ?
>
> On Sun, Jul 11, 2010 at 3:09 PM, Pramy Bhats <pramybhats@googlemail.com
> >wrote:
>
> > Hi,
> >
> > I recently started playing with hadoop source code, when I compiled the
> > source code and built a new jar file using the class files in the build
> > folder.
> >
> > However, when i tried to run the world count example using the new jar
> file
> > -- it gives me the following error. However, i didnt modify the source
> code
> > yet and if i run using the original jar file the program works fine.
> >
> > I'd be grateful, if you could let me know what could be the problem for
> > this
> > ?
> >
> > Error result
> >
> >
> >
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> > org/apache/hadoop/util/PlatformName
> > Caused by: java.lang.ClassNotFoundException:
> > org.apache.hadoop.util.PlatformName
> >    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> >    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> >    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> >    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> > Could not find the main class: org.apache.hadoop.util.PlatformName.
> >  Program
> > will exit.
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> > org/apache/hadoop/util/RunJar
> > Caused by: java.lang.ClassNotFoundException:
> org.apache.hadoop.util.RunJar
> >    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> >    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> >    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> >    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> > Could not find the main class: org.apache.hadoop.util.RunJar.  Program
> will
> > exit.
> >
> >
> >
> > thanks in advance,
> > --PB
> >
>

Re: newly built Jar file

Posted by Ted Yu <yu...@gmail.com>.
It should be in hadoop-core jar:
tyumac:hadoop-0.20.2+320 tyu$ jar tvf
build/hadoop-core-0.20.2-CDH3b2-SNAPSHOT.jar | grep PlatformName
  1048 Fri Jul 02 11:31:04 PDT 2010
org/apache/hadoop/util/PlatformName.class

Did you use "ant jar" command to build ?

On Sun, Jul 11, 2010 at 3:09 PM, Pramy Bhats <pr...@googlemail.com>wrote:

> Hi,
>
> I recently started playing with hadoop source code, when I compiled the
> source code and built a new jar file using the class files in the build
> folder.
>
> However, when i tried to run the world count example using the new jar file
> -- it gives me the following error. However, i didnt modify the source code
> yet and if i run using the original jar file the program works fine.
>
> I'd be grateful, if you could let me know what could be the problem for
> this
> ?
>
> Error result
>
>
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/hadoop/util/PlatformName
> Caused by: java.lang.ClassNotFoundException:
> org.apache.hadoop.util.PlatformName
>    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>    at java.security.AccessController.doPrivileged(Native Method)
>    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> Could not find the main class: org.apache.hadoop.util.PlatformName.
>  Program
> will exit.
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/hadoop/util/RunJar
> Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.RunJar
>    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>    at java.security.AccessController.doPrivileged(Native Method)
>    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> Could not find the main class: org.apache.hadoop.util.RunJar.  Program will
> exit.
>
>
>
> thanks in advance,
> --PB
>