通过 jps 查看没有启动 ResourceManager, 依照上面的门路查看日志
usr/local/Cellar/hadoop/3.2.1/libexec/logs/xxxresourcemanagerxxx.log 通过 vscode 关上
FATAL org.apache.hadoop.yarn.server.resourcemanager.ResourceManager: Error starting ResourceManager
org.apache.hadoop.yarn.webapp.WebAppException: Error starting http server
at org.apache.hadoop.yarn.webapp.WebApps$Builder.start(WebApps.java:443)
at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.startWepApp(ResourceManager.java:1231)
at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.serviceStart(ResourceManager.java:1340)
at org.apache.hadoop.service.AbstractService.start(AbstractService.java:194)
at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.main(ResourceManager.java:1535)
Caused by: java.io.IOException: Unable to initialize WebAppContext
at org.apache.hadoop.http.HttpServer2.start(HttpServer2.java:1177)
at org.apache.hadoop.yarn.webapp.WebApps$Builder.start(WebApps.java:439)
... 4 more
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.NoClassDefFoundError: javax/activation/DataSource
at org.apache.hadoop.yarn.server.resourcemanager.webapp.JAXBContextResolver.<init>(JAXBContextResolver.java:41)
at org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWebApp.setup(RMWebApp.java:54)
while locating org.apache.hadoop.yarn.server.resourcemanager.webapp.JAXBContextResolver
1 error
网上查一下, 是 jdk 版本导致, 我是用的 jdk11, 说是 jdk9 之后就要怎么怎么解决.
网上给的通过批改 hadoop-env.sh 的形式, 写 --all
xxx 这种形式我试了也不胜利, 所以间接还是装置 jdk8 就好了. (装置参考:mac 实现不同版本 jdk 切换)
因为下面形式能够实现不同 jdk 切换, 然而还是会主动跳转到 jdk11, 所以还是要批改 hadoop-env.sh, 应用指定版本的 jdkexport JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home
配置文件的地位如下