Platform: Ubuntu 7.04, JDK 1.6.3, Nutch 0.9, Eclipse 3.3
1、 Nutch 0.9 with Eclipse 3.3 in Ubuntu
參看Nutch的官方文檔 ,裡面說得很詳細了,這裡不在贅述。
2、導入hadoop的源代碼和,可方便在Eclipse中調試代碼和查看API文檔。具體方法如下:
Project properties--> Java Build Path-->Libraries-->hadoop-0.12.2-core.jar,點擊前面三角符號,展開編輯 Source attachment , 選擇hadoop相應版本的src 。
3、 配置Native-hadoop Library,可以提高運行效率,但是調試環境下關係不大,不配置也可。
Project properties--> Java Build Path-->Libraries-->hadoop-0.12.2-core.jar,點擊前面三角符號,展開 編輯 Native library location,加入nutch-0.9/lib/native/Linux-i386-32 即可。
4、解決 「Generator: 0 records selected for fetching, exiting ...」問題
經過上面的配置,已經可以在Eclipse環境中啟動Nutch了,但是程序卻不能正常運行,而出現一個 "Generator: 0 records selected for fetching, exiting ..."報告,程序終止。
經過調試, 發現運行到 Generator.java:424 :
if (readers == null || readers.length == 0 || !readers[0].next( new FloatWritable())) { |
LOG.warn("Generator: 0 records selected for fetching, exiting ..."); 由於 readers[0].next( new FloatWritable() )為false而導致該錯誤的出現。網上相關文章提出適用NUTCH-503解決該問題,但是該補丁針對的是分散式部署時出現的問題,在這裡並不適用,而且經測試也不能解決問題。
解決方法:將tmp_build,也就是項目的默認輸出目錄(default output folder)下的 nutch-site.xml 文件刪掉 或者將該文件中下列屬性註釋掉。
plugin.includes .* Enable all plugins during unit testing. |