线程“main”java.lang.CompatibleClassChangeError中出现异常:找到类org.apache.hadoop.mapreduce.jobcontext,但应为接口

vddsk6oq  于 2021-06-02  发布在  Hadoop
关注(0)|答案(2)|浏览(279)

我正在使用hadoop1.0.3和sqoop1.4.6。我正在尝试将一个表从mysql导入hdfs。我收到以下错误:

Exception in thread "main" java.lang.IncompatibleClassChangeError: Found class org.apache.hadoop.mapreduce.JobContext, but interface was expected
    at org.apache.sqoop.config.ConfigurationHelper.getJobNumMaps(ConfigurationHelper.java:65)
    at com.cloudera.sqoop.config.ConfigurationHelper.getJobNumMaps(ConfigurationHelper.java:36)
    at org.apache.sqoop.mapreduce.db.DataDrivenDBInputFormat.getSplits(DataDrivenDBInputFormat.java:125)
    at org.apache.hadoop.mapred.JobClient.writeNewSplits(JobClient.java:962)
    at org.apache.hadoop.mapred.JobClient.writeSplits(JobClient.java:979)
    at org.apache.hadoop.mapred.JobClient.access$600(JobClient.java:174)
    at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:897)
    at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:850)
    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:1121)
    at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:850)
    at org.apache.hadoop.mapreduce.Job.submit(Job.java:500)
    at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:530)
    at org.apache.sqoop.mapreduce.ImportJobBase.doSubmitJob(ImportJobBase.java:196)
    at org.apache.sqoop.mapreduce.ImportJobBase.runJob(ImportJobBase.java:169)
    at org.apache.sqoop.mapreduce.ImportJobBase.runImport(ImportJobBase.java:266)
    at org.apache.sqoop.manager.SqlManager.importTable(SqlManager.java:673)
    at org.apache.sqoop.manager.MySQLManager.importTable(MySQLManager.java:118)
    at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:497)
    at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:605)
    at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
    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)

有什么建议吗?

neskvpey

neskvpey1#

这是因为sqoop是在Hadoop1.x上编译的,你可以在sqoop网站上下载在Hadoop2.x上编译的sqoop,转到link-releases/Sqoop1应该是这样的,
sqoop-1.4.5.bin\uhadoop-1.0.0.tar.gz
sqoop-1.4.5.bin\uhadoop-2.0.4-alpha.tar.gz
获取sqoop或hadoop2.x应该可以解决这个问题。

hpcdzsge

hpcdzsge2#

问题可能是由于版本。另外,请提供您使用的命令详细信息。
问题可能是由于sqoop/sqoop2引起的。你可以看看这里。或者一般来说,由于sqoop和haddop的版本不同。看这里
sqoop和haddop版本的通用兼容性信息

相关问题