LuckPerms

LuckPerms

41.4k Downloads

Java 9 Compatibility

leNicDev opened this issue · 11 comments

commented

When using the latest Java 9 EA JDK I'm getting the following error when LuckPerms gets loaded:

[13:55:51] [Server thread/INFO]: [LuckPerms] Loading LuckPerms v3.4.6
[13:55:51] [Server thread/INFO]: �[0;37;22m�[21m[�[0;36;1mL�[0;36;22mP�[0;37;22m�[21m] �[0;36;22mIdentified the following dependencies: [CAFFEINE]�[m
[13:55:51] [Server thread/INFO]: �[0;37;22m�[21m[�[0;36;1mLuck�[0;36;22mPerms�[0;37;22m�[21m] �[0;31;22m[ERROR] Failed to load jar for dependency CAFFEINE�[m
[13:55:51] [Server thread/WARN]: java.lang.ClassCastException: java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader
[13:55:51] [Server thread/WARN]: 	at me.lucko.luckperms.common.dependencies.DependencyManager.loadJar(DependencyManager.java:141)
[13:55:51] [Server thread/WARN]: 	at me.lucko.luckperms.common.dependencies.DependencyManager.loadDependencies(DependencyManager.java:106)
[13:55:51] [Server thread/WARN]: 	at me.lucko.luckperms.bukkit.LPBukkitPlugin.onLoad(LPBukkitPlugin.java:154)
[13:55:51] [Server thread/WARN]: 	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:313)
[13:55:51] [Server thread/WARN]: 	at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:205)
[13:55:51] [Server thread/WARN]: 	at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545)
[13:55:51] [Server thread/WARN]: 	at java.base/java.lang.Thread.run(Thread.java:844)

Java 9 is released in 4 days and should be supported by LuckPerms.

commented

For end users, should we be sticking with Java 8 to run minecrafter server? Or should Java 9 work for it? We've upgraded, and seem to be noticing a big of lag. (mainly on chests and bows)

commented

Stick with Java 8.

commented

Side note: Java 9 works perfectly for us. We've even seen minor improvements. We have been running it for months.

... and seem to be noticing a big of lag.

Must be a worldprotect/logging plugin or something. An official released JRE should not cause that.

commented

I've got to apologize at this point. I accidentally posted my original comment after I found this thread via google, without checking what it was in. We are actually running a pure-vanilla server at the moment, no plugins of any kind. Sorry for distracting everyone on a question that isn't actually related to your mod work here.

That being said, if Java 9 is actually improving your performance, I'm interested in knowing what sort of java parameters you are using when you launch MC.

commented

Mind testing a build for me @leNicDev? I don't have the new JRE downloaded yet.

https://transfer.sh/DUXZw/LuckPerms-Bukkit-3.4.6.jar

commented

Using the test build, an additional exception gets thrown:

[19:30:27] [Server thread/INFO]: [LuckPerms] Loading LuckPerms v3.4.6
[19:30:27] [Server thread/ERROR]: null initializing LuckPerms v3.4.6 (Is it up to date?)
java.lang.ExceptionInInitializerError: null
	at me.lucko.luckperms.bukkit.LPBukkitPlugin.onLoad(LPBukkitPlugin.java:154) ~[?:?]
	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:313) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
	at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:205) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
	at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
	at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final jdk.internal.loader.URLClassPath jdk.internal.loader.BuiltinClassLoader.ucp accessible: module java.base does not "opens jdk.internal.loader" to unnamed module @2fe64285
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source) ~[?:?]
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source) ~[?:?]
	at java.lang.reflect.Field.checkCanSetAccessible(Unknown Source) ~[?:?]
	at java.lang.reflect.Field.setAccessible(Unknown Source) ~[?:?]
	at me.lucko.luckperms.common.dependencies.DependencyManager.<clinit>(DependencyManager.java:86) ~[?:?]
	... 5 more
[19:30:27] [Server thread/INFO]: [LuckPerms] Enabling LuckPerms v3.4.6
[19:30:27] [Server thread/INFO]: �[0;36;1m               __       �[0;36;22m __   ___  __         __  �[m
[19:30:27] [Server thread/INFO]: �[0;36;1m    |    |  | /  ` |__/ �[0;36;22m|__) |__  |__)  |\/| /__` �[m
[19:30:27] [Server thread/INFO]: �[0;36;1m    |___ \__/ \__, |  \ �[0;36;22m|    |___ |  \  |  | .__/ �[m
[19:30:27] [Server thread/INFO]:  �[m
[19:30:27] [Server thread/INFO]: �[0;32;22m  Loading version �[0;36;1mv3.4.6�[0;32;22m on Bukkit - CraftBukkit�[m
[19:30:27] [Server thread/INFO]: �[0;30;1m  Running on server version git-Spigot-da42974-8f47214 (MC: 1.12.1) - 1.12.1-R0.1-SNAPSHOT�[m
[19:30:27] [Server thread/INFO]:  �[m
[19:30:27] [Server thread/INFO]: �[0;37;22m�[21m[�[0;36;1mL�[0;36;22mP�[0;37;22m�[21m] �[0;36;22mLoading configuration...�[m
[19:30:27] [Server thread/ERROR]: Error occurred while enabling LuckPerms v3.4.6 (Is it up to date?)
java.lang.NoClassDefFoundError: com/github/benmanes/caffeine/cache/Caffeine
	at me.lucko.luckperms.common.config.AbstractConfiguration.<init>(AbstractConfiguration.java:47) ~[?:?]
	at me.lucko.luckperms.bukkit.BukkitConfig.<init>(BukkitConfig.java:43) ~[?:?]
	at me.lucko.luckperms.bukkit.LPBukkitPlugin.enable(LPBukkitPlugin.java:189) ~[?:?]
	at me.lucko.luckperms.bukkit.LPBukkitPlugin.onEnable(LPBukkitPlugin.java:172) ~[?:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:402) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:384) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:333) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
	at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:206) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
	at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
	at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.ClassNotFoundException: com.github.benmanes.caffeine.cache.Caffeine
	at java.net.URLClassLoader.findClass(Unknown Source) ~[?:?]
	at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
	at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
	... 12 more

Looks like LuckPerms is accessing an internal JDK class which has been moved to an external module.

commented

Yes it is.

In Java 9, the system classloader is no longer an instance of URLClassLoader, which means LuckPerms cannot inject it's dependencies there.

They're now an instance of BuiltinClassLoader, which yeah, is an internal class.

commented

It seems like we can work around the issue by injecting into the plugin classloader, since all implementations use some form of URLClassLoader to load plugins.

commented

a3d78f4

Let me know if it works. (I'm fairly confident it will 😄 )

commented

Yes, it works. Awesome work!

commented

Java 9 is released in 4 days and should be supported by LuckPerms.

The standards around Minecraft are still at Java 8. As long as that's the case use Java 8.
Also fixing this may break the dependency manager on Java 8.