Crash with WorldEdit, java.lang.NoClassDefFoundError: org.apache.logging.log4j.util.ReflectionUtil
alwaeles opened this issue ยท 24 comments
Versions
WorldEdit version: 7.2.0-beta-01 (fabric)
Platform version: Minecraft 1.16.1, Fabric Loader 0.8.8, MultiMC 5
Describe the bug
Crash while loading world.
To Reproduce
- Install MultiMC 5,
- Create an 1.16.1 instance and add Fabric to the instance,
- Add WorldEdit,
- Start the game, and load a world,
- Crash occurs.
Expected behavior
No crashes.
Screenshots
None.
Additional context
Crash report: crash-2020-06-28_11.06.59-server.txt
This sounds like a MultiMC bug, because the normal launcher boots up fine. Can you try again with the normal launcher?
can't reproduce on multimc either https://i.imgur.com/2vJO9dn.png https://i.imgur.com/xCa9MCZ.png
closing unless we get more info (conflict with another mod maybe? would need a mod list).
The exact same issue happens with Forge using HotSpot when creating a new world. Afaict it's because log4j-api-2.11.2.jar which is the library getting loaded, does not have ReflectionUtil anymore, it was removed in 2.9.x
7.2.3 yes. latest.log and crash report for good measure https://gist.github.com/Lartza/61604b09e1f49d2481c12b07d8bf50aa
Just upgraded from worldedit-forge-mc1.16.3-7.2.2-dist.jar to worldedit-mod-7.2.3.jar and getting this error, too. Only on single player worlds, though. The dedicated server starts fine with 7.2.3 and the clients (with 7.2.3) have no issue joining.
Clients using Java8 as in OpenJDK 8u275-b01 or AdoptJDK 8u232-b09, started via MultiMC.
Server using Java8 as in AdoptJDK 8u232-b09 - in case that matters.
Platform: Minecraft 1.16.5, Forge 36.0.42
Client crash in single player with 7.2.3: https://paste.ee/p/7aG4M
Client fine in single player with 7.2.2: https://paste.ee/p/PDBge
Downgraded for now. Thanks for this great mod!
Having this same issue on Forge
https://gist.github.com/Sandriell/a076a88d52148214d7f9e53f2e1b4377
WE: 7.2.3, Forge: 35.1.37
As above, no issue with client/dedicated server.
I have this same error trying to use worldedit-bukkit-7.2.6-SNAPSHOT-dist.jar
with the latest Spigot 1.17 snapshot.
2021-06-12 06:23:21 [ERROR] Could not load 'plugins/WorldEdit-Bukkit-7.2.2.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/ReflectionUtil
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:149) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:384) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:232) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:986) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:307) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/ReflectionUtil
at com.sk89q.worldedit.log4jbridge.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:42) ~[?:?]
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at com.sk89q.worldedit.log4jbridge.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29) ~[?:?]
at com.sk89q.worldedit.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358) ~[?:?]
at com.sk89q.worldedit.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383) ~[?:?]
at com.sk89q.worldedit.bukkit.WorldEditPlugin.<clinit>(WorldEditPlugin.java:113) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:466) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
... 7 more
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.ReflectionUtil
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:142) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
at com.sk89q.worldedit.log4jbridge.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:42) ~[?:?]
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at com.sk89q.worldedit.log4jbridge.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29) ~[?:?]
at com.sk89q.worldedit.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358) ~[?:?]
at com.sk89q.worldedit.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383) ~[?:?]
at com.sk89q.worldedit.bukkit.WorldEditPlugin.<clinit>(WorldEditPlugin.java:113) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:466) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot-1.17.jar:3121-Spigot-66f9d3c-eeae1b1]
... 7 more
Still getting the error with World Edit 7.2.4, Forge 36.1.0 (and 36.1.1) and MultiMC 5 0.6.11-1430 running jdk-15.0.2 as well as jre1.8.0_281
Also tried worldedit-forge-mc1.16.3-7.3.0-SNAPSHOT-dist
Can confirm. Forge 36.1.1, WorldEdit 7.2.4, still an issue https://gist.github.com/Lartza/05d12a66d6e708ec820e79064814a6c0
No one has seen this error without MultiMC so far, this is almost definitely a MultiMC bug, as it works on the vanilla launcher.
Without knowing too much Java or especially mod programming, is it deliberate log4j on Forge is loaded as com.sk89q.worldedit-fabric.slf4j and not com.sk89q.worldedit-forge.slf4j after 36f23bd
And while I don't deny the notion it is true that this is so far the only mod that has this issue with MultiMC too
The thought is that MultiMC is using incorrect classloading order. Basically, the JVM loads classes as they are requested, the -fabric slf4j classes are never requested by the Forge mod, and should therefore never be loaded. It appears as though MultiMC is pre-emptively loading all classes, even ones that should not be loaded. As it hits the fabric classes first due to alphabetical ordering, those are the ones that are used.
This would affect anything that uses optional classes that are dependent on other systems. In this case, the -fabric classes are dependent on being bootstrapped by Fabric. It would also affect any other mod that optionally loads further functionality when in the presence of a different mod though, which is not uncommon.
No, this is not a MultiMC issue.
I just replicated this same issue using the Vanilla Launcher, using the Fabric Installer (god I forgotten how backwards things are using the Vanilla way are vs MultiMC).
Issue is Worldedit itself, not MultiMC
Edit:
Sigh, ignore. This is what happens when you try to remember how to do things the old fashoned way. me4502 is correct.
That error is entirely unrelated - and due to you running a mismatched Minecraft and WorldEdit version
This might be related to ForgeWrapper.
What version of log4j is on classpath when you run it with the vanilla launcher?
With MultiMC/ForgeWrapper, it appears to be 2.11.2.
@kb-1000 I tested it on Technic launcher earlier today which also uses ForgeWrapper and could not reproduce the issue, so its something MultiMC is doing
Just checked, log4j is both defined in net.minecraft/1.16.5.json and net.minecraftforge/36.0.42.json.
In net.minecraft/1.16.5.json, the version is 2.8.1. In net.minecraftforge/36.0.42.json, the version is 2.11.2.
My guess here is that with the Vanilla launcher both versions are on the classpath and the ReflectionUtil
is loaded from the old version of log4j (possibly depending on order, everything is loaded from that version).
The trouble on MultiMC is by design - it will only allow one artefact to be present on the classpath (https://github.com/MultiMC/MultiMC5/blob/5400d4e61389694597381f360e0462932d33bfe1/api/logic/minecraft/LaunchProfile.cpp#L154-L158). It will specifically use the latest version of the library.
I did some digging to verify that MultiMC's data wasn't at fault here, and indeed Forge does upgrade log4j2 in their metadata (see https://gist.github.com/jamierocks/d2737b2d478feb9866f7a9fc90caef51#file-version-json-L240-L261).
I assume Gradle is clever enough to use a single artefact (and the latest), does this work in a Forge development environment?
Yes, we figured that out a long time ago, this is already fixed as indicated by the fact I closed it with a commit.
In fact this will become even more solved with #1715 merge.
The last comments here from 6 days ago by me4502 indicated otherwise, also its not fixed in 7.2.4, the current latest release.
Anyway now I see there's a newer issue #1709 where you seemed to have figured it out 5 days ago. I wouldn't call that a long time ago and people coming from MultiMC were still under the impression you are still blaming the launcher, since that new issue or PR was never posted here, even though there was an ongoing discussion.