我正在处理使用openNLP的代码。我的代码完全在eclipse上运行,但是当我在集群上运行它时,我收到以下错误:
Exception in thread "main" java.lang.NoClassDefFoundError: opennlp/tools/util/ObjectStream
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.apache.hadoop.util.RunJar.main(RunJar.java:153)
Caused by: java.lang.ClassNotFoundException: opennlp.tools.util.ObjectStream
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 java.lang.ClassLoader.loadClass(ClassLoader.java:268)
... 3 more
答案 0 :(得分:2)
您需要在任务的类路径中提供OpenNLP jar。有几种选择:
-libjars
和HADOOP_CLASSPATH,请参阅Using the libjars option with Hadoop 如需更长时间的讨论,请参阅How-to: Include Third-Party Libraries in Your MapReduce Job