修改的第一个文件是:src/java/org/apache/nutch/parse/ParseOutputFormat.java
- public void checkOutputSpecs(FileSystem fs, JobConf job) throws IOException {
- - Path out = FileOutputFormat.getOutputPath(job);
- - if (fs.exists(new Path(out, CrawlDatum.PARSE_DIR_NAME)))
- - throw new IOException("Segment already parsed!");
- + Path out = FileOutputFormat.getOutputPath(job);
- + if ((out == null) && (job.getNumReduceTasks() != 0)) {
- + throw new InvalidJobConfException(
- + "Output directory not set in JobConf.");
- + }
- + if (fs == null) {
- + fs = out.getFileSystem(job);
- + }
- + if (fs.exists(new Path(out, CrawlDatum.PARSE_DIR_NAME)))
- + throw new IOException("Segment already parsed!");
- }
修改的第二个文件是:src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java
- import org.apache.Hadoop.io.SequenceFile.CompressionType;
- import org.apache.hadoop.mapred.FileOutputFormat;
- +import org.apache.hadoop.mapred.InvalidJobConfException;
- import org.apache.hadoop.mapred.OutputFormat;
- import org.apache.hadoop.mapred.RecordWriter;
- import org.apache.hadoop.mapred.JobConf;
- @@ -46,8 +47,15 @@
- public void checkOutputSpecs(FileSystem fs, JobConf job) throws IOException {
- Path out = FileOutputFormat.getOutputPath(job);
- + if ((out == null) && (job.getNumReduceTasks() != 0)) {
- + throw new InvalidJobConfException(
- + "Output directory not set in JobConf.");
- + }
- + if (fs == null) {
- + fs = out.getFileSystem(job);
- + }
- if (fs.exists(new Path(out, CrawlDatum.FETCH_DIR_NAME)))
- - throw new IOException("Segment already fetched!");
- + throw new IOException("Segment already fetched!");
- }
七、问题解决~~
Nutch的详细介绍:请点这里
Nutch的下载地址:请点这里
