hadoop- yarn启动后用jps查看没有resourcemanager

1. 问题

启动hadoop的 yarn时 发现jps 并没有 resourcemanager

2 . 排查

在hadoop-xxx-resourcemanager-.log 日志文件中 发现了报错日志

日志内容如下

context logs
2024-01-15 11:46:14,440 ERROR org.apache.hadoop.yarn.server.resourcemanager.ResourceManager: Error starting ResourceManager
java.lang.ExceptionInInitializerError
	at com.google.inject.internal.cglib.reflect.$FastClassEmitter.(FastClassEmitter.java:67)
	at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:72)
	at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
	at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:216)
	at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:64)
	at com.google.inject.internal.BytecodeGen.newFastClass(BytecodeGen.java:204)
	at com.google.inject.internal.ProviderMethod$FastClassProviderMethod.(ProviderMethod.java:256)
	at com.google.inject.internal.ProviderMethod.create(ProviderMethod.java:71)
	at com.google.inject.internal.ProviderMethodsModule.createProviderMethod(ProviderMethodsModule.java:275)
	at com.google.inject.internal.ProviderMethodsModule.getProviderMethods(ProviderMethodsModule.java:144)
	at com.google.inject.internal.ProviderMethodsModule.configure(ProviderMethodsModule.java:123)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:349)
	at com.google.inject.AbstractModule.install(AbstractModule.java:122)
	at com.google.inject.servlet.ServletModule.configure(ServletModule.java:52)
	at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
	at com.google.inject.spi.Elements.getElements(Elements.java:110)
	at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
	at com.google.inject.Guice.createInjector(Guice.java:96)
	at com.google.inject.Guice.createInjector(Guice.java:73)
	at com.google.inject.Guice.createInjector(Guice.java:62)
	at org.apache.hadoop.yarn.webapp.WebApps$Builder.build(WebApps.java:417)
	at org.apache.hadoop.yarn.webapp.WebApps$Builder.start(WebApps.java:465)
	at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.startWepApp(ResourceManager.java:1389)
	at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.serviceStart(ResourceManager.java:1498)
	at org.apache.hadoop.service.AbstractService.start(AbstractService.java:194)
	at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.main(ResourceManager.java:1700)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @4d7c417d
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
	at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
	at com.google.inject.internal.cglib.core.$ReflectUtils$2.run(ReflectUtils.java:56)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
	at com.google.inject.internal.cglib.core.$ReflectUtils.(ReflectUtils.java:46)
	... 29 more

jdk8之后 限制了跨包访问 如果要访问需要添加 --add-opens java.base/xxx.xxx=ALL-UNNAMED

3. 解决

编辑yarn-env.sh 文件 添加如下参数
export YARN_RESOURCEMANAGER_OPTS=“–add-opens java.base/java.lang=ALL-UNNAMED”
export YARN_NODEMANAGER_OPTS=“–add-opens java.base/java.lang=ALL-UNNAMED”

保存后 然后清空所有hadoop的临时文件 然后尝试重新开启 即可

你可能感兴趣的:(大数据搭建问题,hadoop,大数据,分布式,yarn启动)