Hive异常--java.lang.NoSuchMethodError: org.apache.hadoop.yarn.api.records.Resource.setMemorySize(J)V

错误异常如下所示:

java.lang.NoSuchMethodError: org.apache.hadoop.yarn.api.records.Resource.setMemorySize(J)V

2018-08-30T14:06:08,442 ERROR [d95cabf4-1c04-4bad-9c6d-fa8651fba8f0 main] exec.TaskRunner: Error in executeTask
java.lang.NoSuchMethodError: org.apache.hadoop.yarn.api.records.Resource.setMemorySize(J)V
    at org.apache.hadoop.mapred.YARNRunner.createApplicationSubmissionContext(YARNRunner.java:340) ~[hadoop-mapreduce-client-jobclient-2.8.4.jar:?]
    at org.apache.hadoop.mapred.YARNRunner.submitJob(YARNRunner.java:295) ~[hadoop-mapreduce-client-jobclient-2.8.4.jar:?]
    at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:240) ~[phoenix-4.14.0-HBase-1.4-hive.jar:?]
    at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1290) ~[phoenix-4.14.0-HBase-1.4-hive.jar:?]
    at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1287) ~[phoenix-4.14.0-HBase-1.4-hive.jar:?]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_65]
    at javax.security.auth.Subject.doAs(Subject.java:422) ~[?:1.8.0_65]
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1840) ~[hadoop-common-2.8.4.jar:?]
    at org.apache.hadoop.mapreduce.Job.submit(Job.java:1287) ~[phoenix-4.14.0-HBase-1.4-hive.jar:?]
    at org.apache.hadoop.mapred.JobClient$1.run(JobClient.java:575) ~[phoenix-4.14.0-HBase-1.4-hive.jar:?]
    at org.apache.hadoop.mapred.JobClient$1.run(JobClient.java:570) ~[phoenix-4.14.0-HBase-1.4-hive.jar:?]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_65]
    at javax.security.auth.Subject.doAs(Subject.java:422) ~[?:1.8.0_65]
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1840) ~[hadoop-common-2.8.4.jar:?]
    at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:570) ~[phoenix-4.14.0-HBase-1.4-hive.jar:?]
    at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:561) ~[phoenix-4.14.0-HBase-1.4-hive.jar:?]
    at org.apache.hadoop.hive.ql.exec.mr.ExecDriver.execute(ExecDriver.java:411) ~[hive-exec-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.ql.exec.mr.MapRedTask.execute(MapRedTask.java:151) ~[hive-exec-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:199) ~[hive-exec-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:100) ~[hive-exec-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:2183) ~[hive-exec-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1839) ~[hive-exec-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1526) ~[hive-exec-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1237) ~[hive-exec-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1227) ~[hive-exec-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:233) ~[hive-cli-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:184) ~[hive-cli-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:403) ~[hive-cli-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:821) ~[hive-cli-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:759) ~[hive-cli-2.3.3.jar:2.3.3]
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:686) ~[hive-cli-2.3.3.jar:2.3.3]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_65]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_65]
    at org.apache.hadoop.util.RunJar.run(RunJar.java:234) ~[hadoop-common-2.8.4.jar:?]
    at org.apache.hadoop.util.RunJar.main(RunJar.java:148) ~[hadoop-common-2.8.4.jar:?]
2018-08-30T14:06:08,442 ERROR [d95cabf4-1c04-4bad-9c6d-fa8651fba8f0 main] ql.Driver: FAILED: Execution Error, return code -101 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. org.apache.ha
doop.yarn.api.records.Resource.setMemorySize(J)V

原因:缺少Jar包,在Hadoop的share/hadoop/yarn/hadoop-yarn-api-2.8.4.jar

解决方案:将该Jar包存入Hive的lib目录中即可解决。

点赞