我正在尝试将hdfs文件(或文件夹)导出到postgresql数据库。
这是我使用的命令:
sqoop export --connect jdbc:postgresql://localhost/sqoop_test
--username postgres --password root --table data_csv
--export-dir /data.csv -- --schema sqoop
我得到一个错误:
Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected
at org.apache.sqoop.mapreduce.ExportOutputFormat.checkOutputSpecs(ExportOutputFormat.java:57)
at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:266)
at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:139)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1290)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1287)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1698)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:1287)
at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1308)
at org.apache.sqoop.mapreduce.ExportJobBase.doSubmitJob(ExportJobBase.java:314)
at org.apache.sqoop.mapreduce.ExportJobBase.runJob(ExportJobBase.java:291)
at org.apache.sqoop.mapreduce.ExportJobBase.runExport(ExportJobBase.java:432)
at org.apache.sqoop.manager.SqlManager.exportTable(SqlManager.java:912)
at org.apache.sqoop.tool.ExportTool.exportTable(ExportTool.java:81)
at org.apache.sqoop.tool.ExportTool.run(ExportTool.java:100)
at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
我从postgresql导入数据没有问题。在处理完数据并将其保存到hadoop中之后,我尝试将其保存回postgresql,但是我得到了这个错误。有什么问题吗?
我正在使用 Sqoop 1.4.6
, Hadoop 2.7.3
以及 PostgreSQL 9.4.14
谢谢!
暂无答案!
目前还没有任何答案,快来回答吧!