Caused by: java.lang.ClassNotFoundException: classpath

主宰稳场 提交于 2019-12-12 05:27:28

问题


I am trying to run Wikipedia Bayes Example from https://cwiki.apache.org/confluence/display/MAHOUT/Wikipedia+Bayes+Example

When I ran the following command : $MAHOUT_HOME/bin/mahout wikipediaXMLSplitter -d $MAHOUT_HOME/examples/temp/enwiki-latest-pages-articles10.xml -o wikipedia/chunks -c 64

I am getting this error:

Exception in thread "main" java.lang.NoClassDefFoundError: classpath
Caused by: java.lang.ClassNotFoundException: classpath
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
Running on hadoop, using /x/.../bin/hadoop and HADOOP_CONF_DIR=
MAHOUT-JOB: /x/.../mahout-distribution-0.7/mahout-examples-0.7-job.jar
12/07/25 11:22:06 WARN driver.MahoutDriver: Unable to add class: wikipediaXMLSplitter
12/07/25 11:22:06 WARN driver.MahoutDriver: No wikipediaXMLSplitter.props found on classpath, will use command-line arguments only
Unknown program 'wikipediaXMLSplitter' chosen.

回答1:


I met the same problem, it was caused by the code in bin/mahout(only in version 0.7):

if [ -x "$HADOOP_BINARY" ] ; then
  HADOOP_BINARY_CLASSPATH=$("$HADOOP_BINARY" classpath)
fi

It will exec hadoop classpath and leads to an error. Maybe the version of hadoop is too old for mahout 0.7. Anyway, I commented these three lines and it worked fine.




回答2:


maybe you should use:

mahout -core ... ...

this should work




回答3:


I've run into the same problem. It is solved by specifying org.apache.mahout.text.wikipedia.WikipediaXmlSplitter [note also the different capitalization]

$MAHOUT_HOME/bin/mahout org.apache.mahout.text.wikipedia.WikipediaXmlSplitter -d $MAHOUT_HOME/examples/tmp/enwiki-latest-pages-articles.xml -o wikipedia/chunks



来源:https://stackoverflow.com/questions/11656289/caused-by-java-lang-classnotfoundexception-classpath

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