sqoop執行job報錯(org/json/JSONObject)
阿新 • • 發佈:2018-11-22
[[email protected] ~]# sqoop job --create myjob7 -- import --connect jdbc:mysql://192.168.122.15:3306/company --username hivee --password-file file:///root/a.txt --table erp_admin_article --target-dir '/work/test12'--hive-import --hive-table erp_admin_article --fields-terminated-by ',' -m 1
報錯:
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONObject
at org.apache.sqoop.util.SqoopJsonUtil.getJsonStringforMap(SqoopJsonUtil.java:43)
at org.apache.sqoop.SqoopOptions.writeProperties(SqoopOptions.java:785)
at org.apache.sqoop.metastore.hsqldb.HsqldbJobStorage.createInternal(HsqldbJobStorage.java:399)
......
解決:
這是因為sqoop缺少java-json.jar包.
下載java-json.jar包:
http://www.java2s.com/Code/Jar/j/Downloadjavajsonjar.htm
把java-json.jar新增到../sqoop/lib目錄:
# cp java-json.jar /sqoop/lib