Running Mahout Locally getting ClassNotFoundException for MahoutDriver

北城余情 提交于 2019-12-23 12:38:39

问题


I am trying to run Mahout locally (without Hadoop) on a Windows 8 Machine. I realize this is not the optimal set up but that's what I've got to work with.

When I try to run bin/mahout I get the following error:

$ bin/mahout
MAHOUT_LOCAL is set, so we don't add HADOOP_CONF_DIR to classpath.
no HADOOP_HOME set, running locally
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/mahout/dri
ver/MahoutDriver
Caused by: java.lang.ClassNotFoundException: org.apache.mahout.driver.MahoutDriv
er
    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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.apache.mahout.driver.MahoutDriver.  Program w
ill exit.

I've tried both downloading the source and installing with maven and using the precompiled distribution files, both provided here: http://www.poolsaboveground.com/apache/mahout/

I've also tried with both the 0.7 and 0.6 Mahout versions and gotten the same issue. Not sure if it has anything to do with my java version but I'm using: 1.7.0_09. Also I've set the environment variables MAHOUT_LOCAL = true and MAHOUT_HEAPSIZE=128


回答1:


I never succeded in runing mahout from binary package and it seems that it isn't really a standalone package. Easiest way is to compile from source which is pretty straight forward as far as you have Maven installed:

mkdir mahout
cd mahout/
svn co http://svn.apache.org/repos/asf/mahout/trunk
cd trunk/
mvn compile
mvn install
export MAHOUT_LOCAL=TRUE
export MAHOUT_HEAPSIZE=1000

then you can use this very detailed example to test that your installation is ok: http://www.cs.ucy.ac.cy/courses/EPL660/labs/Stalo/Lab8.pdf




回答2:


I found only now this question, I'm sorry for the late answer.

I think you can solve your problem installing needed modules via Maven, as explained here, with the command:

mvn -DskipTests -X clean install 



回答3:


Did you try setting the CLASSPATH?

export CLASSPATH=${CLASSPATH}:your_MAHOUT_HOME/mahout-distribution-0.7/lib/hadoop/hadoop-core-0.20.204.0.jar 



回答4:


The problem is in the mahout shell script (under bin) that does incorrectly add lib/hadoop/* to the classpath where it should scan the Jar files in this folder to add them indivually to the classpath



来源:https://stackoverflow.com/questions/16973324/running-mahout-locally-getting-classnotfoundexception-for-mahoutdriver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!