Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/zeppelin/server/ZeppelinServer : Unsupported major.minor version 52.0
阅读原文时间:2023年07月09日阅读:4

在启动Zeppelin时遇到了该问题:

[root@quickstart bin]# ./zeppelin-daemon.sh restart
Please specify HADOOP_CONF_DIR if USE_HADOOP is true
./zeppelin-daemon.sh: line 268: /opt/soft/Programs/zeppelin-0.9.0-bin-all/logs/zeppelin-root-quickstart.cloudera.out: No such file or directory
Zeppelin is not running
Log dir doesn't exist, create /opt/soft/Programs/zeppelin-0.9.0-bin-all/logs
Pid dir doesn't exist, create /opt/soft/Programs/zeppelin-0.9.0-bin-all/run
Zeppelin start [ OK ]
Zeppelin process died [FAILED]

通过查看日志信息发现了如下错误:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/zeppelin/server/ZeppelinServer : 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 sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

以上错误一般是由于高版本编译低版本运行导致的,解决的思路第一步查看自己的Java编译版本和运行版本是否一致:

[root@quickstart logs]# java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

既然发现了错误,那就果断删除自带的jdk 1.7换成jdk 1.8的。

1.查看java安装路径

which java

2.删除jdk 1.7

rm -rf /usr/java/jdk1.7.0_67-cloudera

3.删除jdk 1.7的配置文件

vim /etc/profile

4.确认是否删除干净

rpm -qa|grep java

rpm -qa|grep jdk

5.下载解压jdk 1.8

tar -zxvf jdk-8u301-linux-x64.tar.gz

6.修改配置文件

vim /etc/profile

export JAVA_HOME=/usr/java/jdk1.8.0_301

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
7.检查是否重装成功

[root@quickstart java]# source /etc/profile
[root@quickstart java]# java -version
java version "1.8.0_301"
Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.301-b09, mixed mode)

显示重装jdk 1.8成功!

最后验证Zeppelin是否能启动成功

[root@quickstart bin]# ./zeppelin-daemon.sh start
Please specify HADOOP_CONF_DIR if USE_HADOOP is true
Zeppelin start [ OK ]

都没问题了!!!