0

当我尝试

hadoop jar apache-nutch-2.2.jar org.apache.nutch.crawl.Crawler crawl -dir crawl -depth 3 -topN 5

我收到以下错误...

13/07/09 09:02:46 WARN conf.Configuration: nutch-default.xml:a attempt to override final parameter: hadoop.job.history.user.location;  Ignoring.
13/07/09 09:02:46 WARN conf.Configuration: nutch-default.xml:a attempt to override final parameter: hadoop.job.history.user.location;  Ignoring.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/gora/persistency/impl/PersistentBase
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:218)
    at org.apache.nutch.crawl.Crawler.runTool(Crawler.java:68)
    at org.apache.nutch.crawl.Crawler.run(Crawler.java:136)
    at org.apache.nutch.crawl.Crawler.run(Crawler.java:250)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
    at org.apache.nutch.crawl.Crawler.main(Crawler.java:257)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:160)
Caused by: java.lang.ClassNotFoundException: org.apache.gora.persistency.impl.PersistentBase
    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 java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 22 more

有人可以帮我解决错误吗?

4

1 回答 1

1

你有gora依赖的问题。肯定apache-nutch-2.2.jar没有org/apache/gora/persistency/impl/PersistentBase.class。您可以通过以下方式检查:

jar tf apache-nutch-2.2.jar | grep PersistentBase

检查您是否使用 Gora 0.3 版本编译 Nutch。

我猜您的 hadoop 节点中没有安装 gora-* 依赖项,因此解决方案是使用 .job(而不是 .jar)发送它们,女巫已为 Hadoop 捆绑了所有依赖项。

如果你有这个安装:

~
|- nutch/
      |- apache-nutch-2.2.job
      |- bin/
           |- nutch

PATH=~/nutch/bin:.....

您可以使用以下命令执行 Nutch:

$ nutch inject ...

$ nutch crawl

并且nutch命令在需要时调用 Hadoop。

============更新==============

违规行: http: //grepcode.com/file/repo1.maven.org/maven2/org.apache.nutch/nutch/2.2.1/org/apache/nutch/crawl/InjectorJob.java/#218

============更新2 =============

您正在使用命令行调用 Nutch:

hadoop jar nutch...jar

如果你这样做,你必须确保它gora-core-0.x.jar在类路径中。

如果您调用 .job,它必须lib/gora-core-0.x.jar在 zip 中。Hadoop 解压该 .job 并添加lib/*到类路径中,因此不需要做任何事情。

于 2013-07-09T17:14:19.417 回答