mahout程序在eclipse的单机运行正常,然后eclipse export出来打包,hadoop运行:
hadoop jar RF.jar Rf
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/mahout/common/RandomWrapper
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.apache.hadoop.util.RunJar.main(RunJar.java:205)
Caused by: java.lang.ClassNotFoundException: org.apache.mahout.common.RandomWrapper
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
我直接
java -jar RF.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/mahout/common/RandomWrapper
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2570)
at java.lang.Class.getMethod0(Class.java:2813)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: org.apache.mahout.common.RandomWrapper
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more
估计打包有问题。难道这个包找不到还是怎地?
网上有说着pom里面加什么插件什么的,试了试也不好用。
MahoutKaggleDigitRecognizer.java这个类应该引用了org/apache/mahout/common/RandomWrapper吧,你类路径中没有mahout相关的jar包就会出现上述错误 你可以将mahout的jar包放入hadoop的lib目录中,试试吧
早说是hadoop-2.2.0就好了,放到该目录下share\hadoop\common\lib试试
读哪里的文件跟源代码中要求输入的参数有关,具体你可以看一下MahoutKaggleDigitRecognizer.java这个类的源代码,我手头没有这个的代码