GTNewHorizons / lwjgl3ify

A mod to run Minecraft 1.7.10 using LWJGL3 and Java 17+
GNU Lesser General Public License v3.0
170 stars 37 forks source link

server won't start - java.lang.ClassNotFoundException: org.apache.logging.log4j.Level #73

Closed Richard-Rogalski closed 1 year ago

Richard-Rogalski commented 1 year ago

So first, yes, I'm on PPC64le, although this has only been the source of a pure java related problem once, so I don't immediately feel like this is the cause.

So the instructions say to start lwjgl3ify-forgePatches.jar directly, instead of like minecraft.jar right? I get this error when trying to start the jar:

OpenJDK 64-Bit Server VM warning: Ignoring option --illegal-access=warn; support was removed in 17.0
A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at cpw.mods.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:37)
    at cpw.mods.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:11)
Caused by: java.lang.NoClassDefFoundError: org/apache/logging/log4j/Level
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:119)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:29)
    ... 6 more
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.Level
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    ... 8 more

java versions tested, 11, 17, 20, same error

I copied over all the libraries from my client, and ofc from the FTP server I learned about in #72 . The weird thing is, that in both libraries/org/apache/logging/log4j/log4j-api/2.19.0/log4j-api-2.19.0.jar and in libraries/org/apache/logging/log4j/log4j-api/2.0-beta9-fixed/log4j-api-2.0-beta9-fixed.jar, there is a org/apache/logging/log4j/Level.class inside these jars.

To make sure it was present on the classpath, I put $(find /var/lib/minecraft/mcserver/libraries/ -name "*jar" | sed ':a;N;$!ba;s/\n/:/g') in my java args, which does include every single jar file in libraries.

That's duplicate libs ofc, 2.19.0 and 2.0, but I don't think that could cause this error....

Does anyone have any ideas of things I should try?

The server I use is thermos, but I don't think that's the issue as this error happens regardless of if a server jar is even present.

Also, if someone wants to play around and see the error for themselves, drop me an SSH pubkey on the discord (rrogalski_) or here.

Richard-Rogalski commented 1 year ago

I've tried launching it every way possible, but here is my main launch script for reference:

mcjar="/var/lib/minecraft/mcserver/lwjgl3ify-forgePatches.jar"

java9args="--illegal-access=warn -Djava.security.manager=allow -Dfile.encoding=UTF-8 --add-opens java.base/jdk.internal.loader=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming --add-opens java.desktop/sun.awt.image=ALL-UNNAMED --add-opens java.desktop/com.sun.imageio.plugins.png=ALL-UNNAMED --add-modules jdk.dynalink --add-opens jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED --add-modules java.sql.rowset --add-opens java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED"

java ${java9args} --class-path $(find /var/lib/minecraft/mcserver/libraries/ -name "*jar" | sed ':a;N;$!ba;s/\n/:/g') -XX:+UnlockExperimentalVMOptions -XX:+OptimizeStringConcat -XX:MetaspaceSize=1024m -XX:MaxMetaspaceSize=2048m -XX:+UseStringDeduplication -Xms4G -Xmx22G -XX:hashCode=5 -Dfile.encoding=UTF-8 -Dfml.readTimeout=80 -jar ${mcjar} nogui

I've tried excluding things, including things, etc etc, no luck

Richard-Rogalski commented 1 year ago

uhhhh confused. some things:

This is NOT a PPC related issue, I sshfs mounted the directory and get the same error on an x86 host.

So you import log4j in a few places:

src/main/java/me/eigenraven/lwjgl3ify/mixins/fml/ObjectHolderRef.java
src/forgePatches/java/cpw/mods/fml/common/patcher/ClassPatchManager.java
src/main/java/me/eigenraven/lwjgl3ify/mixins/fml/ItemStackHolderRef.java
src/forgePatches/java/cpw/mods/fml/relauncher/CoreModManager.java

however, looking in #72 , nothing related to log4j seems to be in your DAAXL mirror or in your server archive zipfiles.

Sooooo, am I supposed to have log4j in my libraries? If so, what version? Or is it supposed to be sourced from somewhere else? In my minecraft.jar I only have:

org/apache/logging/log4j/core/appender/ConsoleAppender$1.class
org/apache/logging/log4j/core/appender/ConsoleAppender$ConsoleManagerFactory.class
org/apache/logging/log4j/core/appender/ConsoleAppender$FactoryData.class
org/apache/logging/log4j/core/appender/ConsoleAppender$SystemErrStream.class
org/apache/logging/log4j/core/appender/ConsoleAppender$SystemOutStream.class
org/apache/logging/log4j/core/appender/ConsoleAppender$Target.class
org/apache/logging/log4j/core/appender/ConsoleAppender.class

and that's it.

eigenraven commented 1 year ago

Have you installed the forge server using forge's installer first? The libraries folder is mostly set up by that, and then you have to copy over the missing libraries from either your client, or you can find them e.g. at https://github.com/GTNewHorizons/DreamAssemblerXXL/tree/master/server_assets/forge/libraries

Richard-Rogalski commented 1 year ago

I can't recall, I first set up this server years ago :^). I'll try running the forge installer again.

Richard-Rogalski commented 1 year ago

heh, I think I figured it out..... forgepatches looks EXPLICITLY for minecraft_server.1.7.10.jar. I had my server jar named to minecraft.jar. I'm getting more errors, I'll close this issue assuming I can figure them out.... :)

Richard-Rogalski commented 1 year ago

Other errors seem related to thermos, bah, seems like it works with normal forge server jar. I'll look at porting those patches to thermos another day then.

Would I have to rewrite most of the patches, or do you think I could get away with lightly tweaking them?

eigenraven commented 1 year ago

Ah I completely missed you saying you use thermos, yes that's not supported at all at the moment and tbh it's more likely we'll write plugin replacements as forge mods than patch thermos for modern java.

Richard-Rogalski commented 1 year ago

Well what if I wrote/tweaked the patches? I don't know anything about mixins/asm yet but I've been meaning to learn :-)

eigenraven commented 1 year ago

The patches in the patches jar are actually full class replacements (and the asm&mixins are in the mod jar), I'm not sure which parts are incompatible exactly but you'd probably have to fix up bukkit's plugin loading mechanism in thermos the same way I fix up FML in forge

Richard-Rogalski commented 11 months ago

BTW @eigenraven: experimental crucible build works with j17+, no mods needed. The build is just exclusive to a discord attachment(crucible's) at this second from what I'm aware, but feel free to redirect people there who have been asking for thermos support!!

https://cdn.discordapp.com/attachments/682366014939201544/1188955655168610374/Crucible-1.7.10-newJava-b6c6639d-server.jar?ex=659c683d&is=6589f33d&hm=163823cc89f65f752a82f1d39db92f8680c2d0982f1e9daf03a27bddabdc69de& < the first experimental build in question, has issues like broken stdout, etc.