How to resolve load main class MahoutDriver error

2019-09-01 06:13发布

问题:

I am trying to run the 2newsgroup classification example in Mahout. I have set MAHOUT_LOCAL=true, the classifier doesn't display the Confusion matrix and gives the following warnings :

ok. You chose 2 and we'll use naivebayes
creating work directory at /tmp/mahout-work-cloudera
+ echo 'Preparing 20newsgroups data'
Preparing 20newsgroups data
+ rm -rf /tmp/mahout-work-cloudera/20news-all
+ mkdir /tmp/mahout-work-cloudera/20news-all
+ cp -R /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/alt.atheism /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/comp.graphics /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/comp.os.ms-windows.misc /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/comp.sys.ibm.pc.hardware /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/comp.sys.mac.hardware /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/comp.windows.x /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/misc.forsale /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/rec.autos /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/rec.motorcycles /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/rec.sport.baseball /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/rec.sport.hockey /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/sci.crypt /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/sci.electronics /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/sci.med /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/sci.space /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/soc.religion.christian /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/talk.politics.guns /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/talk.politics.mideast /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/talk.politics.misc /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-test/talk.religion.misc /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/alt.atheism /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/comp.graphics /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/comp.os.ms-windows.misc /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/comp.sys.ibm.pc.hardware /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/comp.sys.mac.hardware /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/comp.windows.x /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/misc.forsale /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/rec.autos /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/rec.motorcycles /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/rec.sport.baseball /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/rec.sport.hockey /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/sci.crypt /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/sci.electronics /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/sci.med /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/sci.space /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/soc.religion.christian /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/talk.politics.guns /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/talk.politics.mideast /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/talk.politics.misc /tmp/mahout-work-cloudera/20news-bydate/20news-bydate-train/talk.religion.misc /tmp/mahout-work-cloudera/20news-all
+ '[' '' '!=' '' ']'
+ echo 'Creating sequence files from 20newsgroups data'
Creating sequence files from 20newsgroups data
+ ./bin/mahout seqdirectory -i /tmp/mahout-work-cloudera/20news-all -o /tmp/mahout-work-cloudera/20news-seq -ow


MAHOUT_LOCAL is set, so we don't add HADOOP_CONF_DIR to classpath.
MAHOUT_LOCAL is set, running locally
Error: Could not find or load main class org.apache.mahout.driver.MahoutDriver

Please give me any solution Thanks.

回答1:

This error was due to incorrect apache maven path and POM file i simply put pom.xml file (including mahout-master full source code ) under apache-maven-3.2.1 and run command again this method definitely solve this problem.