在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

运行nutch报错unzipBestEffort returned null怎么办

152次阅读
没有评论

共计 2891 个字符,预计需要花费 8 分钟才能阅读完成。

丸趣 TV 小编今天带大家了解运行 nutch 报错 unzipBestEffort returned null 怎么办,文中知识点介绍的非常详细。觉得有帮助的朋友可以跟着丸趣 TV 小编一起浏览文章的内容,希望能够帮助更多想解决这个问题的朋友找到问题的答案,下面跟着丸趣 TV 小编一起深入学习“运行 nutch 报错 unzipBestEffort returned null 怎么办”的知识吧。

报错信息:fetch of http://szs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201402/t20140224_1046354.html failed with: java.io.IOException: unzipBestEffort returned null

完整的报错信息为:

2014-03-12 16:48:38,031 ERROR http.Http - Failed to get protocol output
java.io.IOException: unzipBestEffort returned null
at org.apache.nutch.protocol.http.api.HttpBase.processGzipEncoded(HttpBase.java:317)
at org.apache.nutch.protocol.http.HttpResponse. init (HttpResponse.java:164)
at org.apache.nutch.protocol.http.Http.getResponse(Http.java:64)
at org.apache.nutch.protocol.http.api.HttpBase.getProtocolOutput(HttpBase.java:140)
at org.apache.nutch.fetcher.Fetcher$FetcherThread.run(Fetcher.java:703)
2014-03-12 16:48:38,031 INFO fetcher.Fetcher - fetch of http://szs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201402/t20140224_1046354.html failed with: java.io.IOException: unzipBestEffort returned null
2014-03-12 16:48:38,031 INFO fetcher.Fetcher - -finishing thread FetcherThread, activeThreads=0

由此可知抛出异常的代码位于 src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java(lib-http 插件)类的 processGzipEncoded 方法的 317 行:

byte[] content;
if (getMaxContent()  = 0) { content = GZIPUtils.unzipBestEffort(compressed, getMaxContent());
} else { content = GZIPUtils.unzipBestEffort(compressed);
if (content == null)
 throw new IOException(unzipBestEffort returned null

nutch2.7\src\plugin\protocol-http\src\java\org\apache\nutch\protocol\http\HttpResponse.java(protocol-http 插件)的 164 行调用了 processGzipEncoded 方法: 

readPlainContent(in);
String contentEncoding = getHeader(Response.CONTENT_ENCODING);
if (gzip .equals(contentEncoding) ||  x-gzip .equals(contentEncoding)) {content = http.processGzipEncoded(content, url);
} else if (deflate .equals(contentEncoding)) {content = http.processDeflateEncoded(content, url);
} else {if (Http.LOG.isTraceEnabled()) {Http.LOG.trace( fetched   + content.length +   bytes from   + url);
}

通过 Firefox 的 Firebug 工具可查看该 URL 的响应头为 Content-Encoding:gzip,Transfer-Encoding:chunked。

解决方法如下:

1、修改文件 nutch2.7\src\java\org\apache\nutch\metadata\HttpHeaders.java,增加一个 field:

public final static String TRANSFER_ENCODING =  Transfer-Encoding

 
2、修改文件 nutch2.7\src\plugin\protocol-http\src\java\org\apache\nutch\protocol\http\HttpResponse.java,替换第 160 行代码 readPlainContent(in); 为如下代码

String transferEncoding = getHeader(Response.TRANSFER_ENCODING); 
if(transferEncoding != null    chunked .equalsIgnoreCase(transferEncoding.trim())){   
 readChunkedContent(in, line); 
}else{ readPlainContent(in); 
}

3、http 内容长度限制不能使用负值,只能使用一个大整数:

property 
 name http.content.limit /name 
 value 655360000 /value 
 /property

 
4、因为修改了核心代码和插件代码,所以需要重新编译打包发布,执行 nutch2.7\build.xml 的默认 target:runtime 

cd nutch2.7
ant

感谢大家的阅读,以上就是“运行 nutch 报错 unzipBestEffort returned null 怎么办”的全部内容了,学会的朋友赶紧操作起来吧。相信丸趣 TV 丸趣 TV 小编一定会给大家带来更优质的文章。谢谢大家对丸趣 TV 网站的支持!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-03发表,共计2891字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 国产免费爽爽视频免费可以看 | 国产成人91一区二区三区 | 亚洲国产欧美精品一区二区三区 | 影音先锋人妻啪啪av资源网站 | 一级做a爰片欧美aaaa | 成人免费观看高清在线毛片 | 国产成人亚洲精品青草天美 | 中文字幕一区二区三区四区五区 | 亚洲夂夂婷婷色拍ww47 | 国产精品久久久久久久 | 亚洲一级生活片 | 人人色在线视频播放 | 久久精品男人影院 | 国产成人视屏 | 刺激性视频黄页 | 天天躁狠狠躁狠狠躁夜夜躁 | 精品日韩一区二区三区视频 | 久热在线这里只有精品 | 一级毛片视频免费观看 | 欧美最猛的24k毛片视频 | 国产偷人爽久久久久久老妇app | 武则天性欲史 在线播放 | 亚洲中文字幕无码av | 伊人情人综合网 | 男女后进式猛烈xx00动态图片 | 日本免费性 | 欧美2区| 亚洲成av人片在线观看www | 国产肥熟女视频一区二区三区 | 日本公与熄乱理在线播放 | 麻豆av一区二区天美传媒 | 末成年女av片一区二区 | 久久美女网 | 国产一区二区在免费观看 | 天天躁人人躁人人躁狂躁 | 热@国产| 亚洲熟妇无码另类久久久 | 久久免费精品视频 | 在线播放一级片 | 爱爱小视频在线看免费 | 人妻少妇偷人精品无码 |