nutch 2.1+mysql報錯及解決方案

來源:互聯網
上載者:User

錯誤資訊:

java.io.IOException: java.sql.BatchUpdateException: Incorrect string value: '\xD6\xD0\xB9\xFA\xB9\xA4...' for column 'content' at row 1

at org.apache.gora.sql.store.SqlStore.flush(SqlStore.java:340)

at org.apache.gora.sql.store.SqlStore.close(SqlStore.java:185)

at org.apache.gora.mapreduce.GoraRecordWriter.close(GoraRecordWriter.java:55)

at org.apache.hadoop.mapred.ReduceTask$NewTrackingRecordWriter.close(ReduceTask.java:579)

at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:650)

at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:417)

at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:260)

Caused by: java.sql.BatchUpdateException: Incorrect string value: '\xD6\xD0\xB9\xFA\xB9\xA4...' for column 'content' at row 1

at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1666)

at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1082)

at org.apache.gora.sql.store.SqlStore.flush(SqlStore.java:328)

解決方案:

在nutch2.1

中配置

<property>

 <name>encodingdetector.charset.min.confidence</name>

 <value>1</value>

 <description>A integer between 0-100 indicating minimum confidence value

 for charset auto-detection. Any negative value disables auto-detection.

 </description>

</property>

並確保mysql資料庫編碼為UTF-8

作者:iteye yangshangchuan

查看本欄目更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/webkf/tools/

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.