You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by "Mizrachi, Dror" <dr...@intel.com> on 2012/08/26 09:32:49 UTC

java.lang.NoClassDefFoundError: org/apache/commons/cli2/Option

Hi

I'm a new Mahout user.
I tried running the follow command and got this exception - any idea why and how to solve it?

$ hadoop jar mahout-core-0.5.jar org.apache.mahout.cf.taste.hadoop.item.RecommenderJob -Dmapred.input.dir=/user/xxx/input -Dmapred.output.dir=/user/xxx/output --recommenderClassName org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender --numRecommendations 10
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli2/Option
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:247)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:179)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli2.Option
        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:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 3 more


Thanks,
Dror

---------------------------------------------------------------------
Intel Electronics Ltd.

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

Re: java.lang.NoClassDefFoundError: org/apache/commons/cli2/Option

Posted by Phoenix Bai <ba...@gmail.com>.
Or instead of invoking mahout in format "$ hadoop jar mahout-core-0.5.jar ",
you should try "$mahout ......".
in $MAHOUT_HOME/bin, there lies the mahout script which will load all
necessary jar files before run any classes. the jars that required by
mahout are normally put in $MAHOUT_HOME/lib

e.g.

$mahout seq2sparse -i /group/tbdev/zhimo.bmz/mahout/data/vtitle_seq -o
/group/tbdev/zhimo.bmz/mahout/vectors/vtitle-vectors -ow \
-a org.apache.lucene.analysis.WhitespaceAnalyzer \
-wt tfidf \
-x 90 \
-seq \
-n 2


On Sun, Aug 26, 2012 at 10:50 PM, Sean Owen <sr...@gmail.com> wrote:

> The JAR you ship to Hadoop needs to have all the required class files
> including third-party dependencies. Right now you're just sending it
> Mahout classes. Use the ".job" file that is built by the Maven
> targets. mvn package should make them. That has all the dependencies
> packaged up.
>
> On Sun, Aug 26, 2012 at 3:32 AM, Mizrachi, Dror <dr...@intel.com>
> wrote:
> > Hi
> >
> > I'm a new Mahout user.
> > I tried running the follow command and got this exception - any idea why
> and how to solve it?
> >
> > $ hadoop jar mahout-core-0.5.jar
> org.apache.mahout.cf.taste.hadoop.item.RecommenderJob
> -Dmapred.input.dir=/user/xxx/input -Dmapred.output.dir=/user/xxx/output
> --recommenderClassName
> org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender
> --numRecommendations 10
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/commons/cli2/Option
> >         at java.lang.Class.forName0(Native Method)
> >         at java.lang.Class.forName(Class.java:247)
> >         at org.apache.hadoop.util.RunJar.main(RunJar.java:179)
> > Caused by: java.lang.ClassNotFoundException:
> org.apache.commons.cli2.Option
> >         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:306)
> >         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> >         ... 3 more
> >
> >
> > Thanks,
> > Dror
> >
> > ---------------------------------------------------------------------
> > Intel Electronics Ltd.
> >
> > This e-mail and any attachments may contain confidential material for
> > the sole use of the intended recipient(s). Any review or distribution
> > by others is strictly prohibited. If you are not the intended
> > recipient, please contact the sender and delete all copies.
>

Re: java.lang.NoClassDefFoundError: org/apache/commons/cli2/Option

Posted by Sean Owen <sr...@gmail.com>.
The JAR you ship to Hadoop needs to have all the required class files
including third-party dependencies. Right now you're just sending it
Mahout classes. Use the ".job" file that is built by the Maven
targets. mvn package should make them. That has all the dependencies
packaged up.

On Sun, Aug 26, 2012 at 3:32 AM, Mizrachi, Dror <dr...@intel.com> wrote:
> Hi
>
> I'm a new Mahout user.
> I tried running the follow command and got this exception - any idea why and how to solve it?
>
> $ hadoop jar mahout-core-0.5.jar org.apache.mahout.cf.taste.hadoop.item.RecommenderJob -Dmapred.input.dir=/user/xxx/input -Dmapred.output.dir=/user/xxx/output --recommenderClassName org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender --numRecommendations 10
> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli2/Option
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:247)
>         at org.apache.hadoop.util.RunJar.main(RunJar.java:179)
> Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli2.Option
>         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:306)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>         ... 3 more
>
>
> Thanks,
> Dror
>
> ---------------------------------------------------------------------
> Intel Electronics Ltd.
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.