Hadoop 2.7.4 namenode无法启动:不支持的major.minor版本52.0

时间:2017-08-22 15:47:40

标签: java hadoop java-7

我最近遇到了问题,在单节点机器上安装hadoop。

命令的错误日志

bin/hadoop namenode -format

STARTUP_MSG:   java = 1.7.0_80
************************************************************/
17/08/22 21:03:56 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]
17/08/22 21:03:56 INFO namenode.NameNode: createNameNode [-format]
17/08/22 21:03:58 ERROR namenode.NameNode: Failed to start namenode.
java.lang.UnsupportedClassVersionError: org/apache/hadoop/mapreduce/lib/output/SequenceFileAsBinaryOutputFormat : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at org.apache.hadoop.mapreduce.util.ConfigUtil.addDeprecatedKeys(ConfigUtil.java:54)
    at org.apache.hadoop.mapreduce.util.ConfigUtil.loadResources(ConfigUtil.java:42)
    at org.apache.hadoop.mapred.JobConf.<clinit>(JobConf.java:119)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:278)
    at org.apache.hadoop.conf.Configuration.getClassByNameOrNull(Configuration.java:2134)
    at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:95)
    at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:78)
    at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:136)
    at org.apache.hadoop.security.Groups.<init>(Groups.java:79)
    at org.apache.hadoop.security.Groups.<init>(Groups.java:74)
    at org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:303)
    at org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:285)
    at org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:262)
    at org.apache.hadoop.security.UserGroupInformation.isAuthenticationMethodEnabled(UserGroupInformation.java:339)
    at org.apache.hadoop.security.UserGroupInformation.isSecurityEnabled(UserGroupInformation.java:333)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:968)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1441)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1566)
17/08/22 21:03:58 INFO util.ExitUtil: Exiting with status 1
17/08/22 21:03:58 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at hplap/127.0.1.1
************************************************************/

我使用的java版本是

hduser@hplap:/usr/local/hadoop$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

路径变量是

hduser@hplap:/usr/local/hadoop$ echo $PATH
/home/hduser/bin:/home/hduser/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin:/home/hduser/bin:/usr/lib/java/jdk1.7.0_80/bin:/usr/local/hadoop/bin

hadoop-env.sh的java主页是

导出JAVA_HOME = / usr / lib / java / jdk1.7.0_80

1 个答案:

答案 0 :(得分:5)

此代码已编译为在Java 8上运行。您的群集上似乎有一个以前版本的JVM。