安装tutorial的步骤安装Nutch,当执行下面这条命令时出现异常
bin/nutch crawl urls -dir crawl -depth -topN
Injector: starting at -- ::
Injector: crawlDb: crawl/crawldb
Injector: urlDir: urls
Injector: Converting injected urls to crawl db entries.
Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-hzhang\mapred\staging\hzhang234102884\.staging to
at org.apache.hadoop.fs.FileUtil.checkReturnValue(FileUtil.java:)
at org.apache.hadoop.fs.FileUtil.setPermission(FileUtil.java:)
at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:)
at org.apache.hadoop.fs.RawLocalFileSystem.mkdirs(RawLocalFileSystem.java:)
at org.apache.hadoop.fs.FilterFileSystem.mkdirs(FilterFileSystem.java:)
at org.apache.hadoop.mapreduce.JobSubmissionFiles.getStagingDir(JobSubmissionFiles.java:)
at org.apache.hadoop.mapred.JobClient$.run(JobClient.java:)
at org.apache.hadoop.mapred.JobClient$.run(JobClient.java:)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:)
at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:)
at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:)
at org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:)
at org.apache.nutch.crawl.Injector.inject(Injector.java:)
at org.apache.nutch.crawl.Crawl.run(Crawl.java:)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:)
at org.apache.nutch.crawl.Crawl.main(Crawl.java:)
解决方法:
替换掉Nutch lib目录下的hadoop-core-*.jar包。我试验的Nutch版本是apache-nutch-1.7, lib下的hadoop包为hadoop-core-1.2.0.jar, 替换为hadoop-core-0.20.2-cdh3u2.jar后没有异常出现,命令执行成功。