版本为 hadoop-3.1.3,这个问题出现的原因很多,首先是看报错日志:
[root@tcloud sbin]# cd /usr/local/hadoop-3.1.3/logs/ [root@tcloud logs]# ll # 查看最新的 resourcemanager 日志 [root@tcloud logs]# cat ./hadoop-root-resourcemanager-tcloud.log
主要的报错信息如下:
Error injecting constructor, java.lang.NoClassDefFoundError: javax/activation/DataSource
这显然不是Hadoop的配置问题,报错时,我是用的jdk版本是:
[root@tcloud ~]# java -version openjdk version "11" 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
我将jdk换回8:
[root@tcloud logs]# java -version java version "1.8.0_251" Java(TM) SE Runtime Environment (build 1.8.0_251-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
[root@tcloud sbin]# ./start-yarn.sh Starting resourcemanager Last login: Wed Jul 28 17:22:16 CST 2021 from 123.160.246.239 on pts/1 Last failed login: Wed Jul 28 17:38:44 CST 2021 from 192.64.83.51 on ssh:notty There were 41 failed login attempts since the last successful login. Starting nodemanagers Last login: Wed Jul 28 17:39:14 CST 2021 on pts/1
问题解决。
不得不总结一下,最新的jdk版本已经到17了,我们还止步在8,原因还是挺多的,不仅仅是升级成本高,还有很多不兼容的问题存在。