这个问题在这里已经有答案了:
如何修复java.lang.unsupportedclassversionerror:不支持的主要版本。次要版本(51个答案)
两年前关门了。
我最近在单节点机器上安装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)
path变量为
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\u home=/usr/lib/java/jdk1.7.0\u 80
1条答案
按热度按时间mxg2im7a1#
这段代码被编译为在Java8上运行。您的集群上似乎有以前版本的jvm。