bergerhealer / BKCommonLib

An extensive library used in bergerhealer's plugins
Other
181 stars 45 forks source link

InaccessibleObjectException on startup with Java 16 #122

Closed GriffinCodes closed 3 years ago

GriffinCodes commented 3 years ago
BkCommonLib version: 1.16.5-v2
Spigot version: Paper 1.16.5 #654

Problem or bug:

2021-05-13 11:38:46 | [BKCommonLib] Loading BKCommonLib v1.16.5-v2
2021-05-13 11:38:46 | [ERROR] [REFLECTION] Failed to initialize class 'net.minecraft.server.v1_16_R3.MinecraftServer':
2021-05-13 11:38:46 | [RAW] java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @1fe58e1d
2021-05-13 11:38:46 | [RAW]     at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at java.lang.reflect.Method.setAccessible(Method.java:193) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.mountiplex.reflection.util.GeneratorClassLoader.<clinit>(GeneratorClassLoader.java:44) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.mountiplex.reflection.util.asm.MPLType.<clinit>(MPLType.java:551) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.mountiplex.reflection.resolver.Resolver.loadClassImpl(Resolver.java:196) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.mountiplex.reflection.resolver.Resolver.loadClass(Resolver.java:153) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.mountiplex.reflection.resolver.Resolver.loadClass(Resolver.java:137) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.bukkit.common.server.CraftBukkitServer.loadClass(CraftBukkitServer.java:155) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.bukkit.common.server.CraftBukkitServer.postInit(CraftBukkitServer.java:79) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.bukkit.common.internal.CommonBootstrap.initCommonServer(CommonBootstrap.java:108) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.bukkit.common.Common.<clinit>(Common.java:114) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.bukkit.common.internal.CommonPlugin.onLoad(CommonPlugin.java:379) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:394) ~[patched_1.16.5.jar:git-Parchment-"5a9c92b"]
2021-05-13 11:38:46 | [RAW]     at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:252) ~[patched_1.16.5.jar:git-Parchment-"5a9c92b"]
2021-05-13 11:38:46 | [RAW]     at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065) ~[patched_1.16.5.jar:git-Parchment-"5a9c92b"]
2021-05-13 11:38:46 | [RAW]     at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Parchment-"5a9c92b"]
2021-05-13 11:38:46 | [RAW]     at java.lang.Thread.run(Thread.java:831) [?:?]
2021-05-13 11:38:46 | [WARN] java.lang.NoClassDefFoundError: Could not initialize class com.bergerkiller.mountiplex.reflection.util.asm.MPLType
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.mountiplex.reflection.declarations.ClassResolver.resolvePath(ClassResolver.java:675)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.mountiplex.reflection.declarations.TypeDeclaration.<init>(TypeDeclaration.java:110)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.mountiplex.reflection.resolver.Resolver$ClassMeta.<init>(Resolver.java:434)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.mountiplex.reflection.resolver.Resolver.getMeta(Resolver.java:101)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.mountiplex.reflection.declarations.TypeDeclaration.fromClass(TypeDeclaration.java:899)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.mountiplex.reflection.declarations.TypeDeclaration.<clinit>(TypeDeclaration.java:36)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.mountiplex.reflection.resolver.Resolver$ClassMeta.<init>(Resolver.java:438)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.mountiplex.reflection.resolver.Resolver.loadClass(Resolver.java:155)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.mountiplex.reflection.resolver.Resolver.loadClass(Resolver.java:137)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.bukkit.common.server.CraftBukkitServer.loadClass(CraftBukkitServer.java:155)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.bukkit.common.server.CraftBukkitServer.postInit(CraftBukkitServer.java:79)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.bukkit.common.internal.CommonBootstrap.initCommonServer(CommonBootstrap.java:108)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.bukkit.common.Common.<clinit>(Common.java:114)
2021-05-13 11:38:46 | [WARN] at com.bergerkiller.bukkit.common.internal.CommonPlugin.onLoad(CommonPlugin.java:379)
2021-05-13 11:38:46 | [WARN] at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:394)
2021-05-13 11:38:46 | [WARN] at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:252)
2021-05-13 11:38:46 | [WARN] at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065)
2021-05-13 11:38:46 | [WARN] at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289)
2021-05-13 11:38:46 | [WARN] at java.base/java.lang.Thread.run(Thread.java:831)
2021-05-13 11:38:46 | [ERROR] [org.bukkit.craftbukkit.v1_16_R3.CraftServer] Could not initialize class com.bergerkiller.mountiplex.reflection.util.asm.MPLType initializing BKCommonLib v1.16.5-v2 (Is it up to date?)
2021-05-13 11:38:46 | [RAW] java.lang.NoClassDefFoundError: Could not initialize class com.bergerkiller.mountiplex.reflection.util.asm.MPLType
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.mountiplex.reflection.resolver.Resolver.loadClassImpl(Resolver.java:196) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.mountiplex.reflection.resolver.Resolver.loadClass(Resolver.java:153) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.mountiplex.reflection.resolver.Resolver.loadClass(Resolver.java:137) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.bukkit.common.internal.CommonBootstrap.initResolvers(CommonBootstrap.java:248) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.bukkit.common.internal.CommonBootstrap.initCommonServer(CommonBootstrap.java:125) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.bukkit.common.Common.<clinit>(Common.java:114) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at com.bergerkiller.bukkit.common.internal.CommonPlugin.onLoad(CommonPlugin.java:379) ~[?:?]
2021-05-13 11:38:46 | [RAW]     at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:394) ~[patched_1.16.5.jar:git-Parchment-"5a9c92b"]
2021-05-13 11:38:46 | [RAW]     at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:252) ~[patched_1.16.5.jar:git-Parchment-"5a9c92b"]
2021-05-13 11:38:46 | [RAW]     at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065) ~[patched_1.16.5.jar:git-Parchment-"5a9c92b"]
2021-05-13 11:38:46 | [RAW]     at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Parchment-"5a9c92b"]
2021-05-13 11:38:46 | [RAW]     at java.lang.Thread.run(Thread.java:831) [?:?]
bergerkiller commented 3 years ago

Adding this jvm flag could help: --add-opens java.base/java.lang=ALL-UNNAMED

See also: https://stackoverflow.com/a/41265267

GriffinCodes commented 3 years ago

It does, but that seems like a workaround, rather than a fix? Every server owner would need to add that flag for the plugin to work

bergerkiller commented 3 years ago

Yup. Blame oracle.

bergerkiller commented 3 years ago

I'm trying to see if there's something I can do on my end, as there is a way out with the MethodHandles API.

bergerkiller commented 3 years ago

This problem should be fixed, hopefully. Let me know if there are any other moments where this error pops up. https://github.com/bergerhealer/Mountiplex/commit/d05c9fb4983618154b323534440cb4430f79ccc2

https://ci.mg-dev.eu/job/BKCommonLib/1037/