Awakened-Redstone / AutoWhitelist

A way to automate the whitelist of a minecraft server based on discord roles
GNU Lesser General Public License v3.0
6 stars 7 forks source link

[1.19.2-1.1.2] Mod upgrades OkHttp3 to 4.9.3 causing fatal fail #16

Closed DenisMasterHerobrine closed 1 year ago

DenisMasterHerobrine commented 1 year ago

Version information

1.1.2 (MC 1.19.2)

Expected Behavior

The bot should start as intended and begin accepting np!register commands so people could whitelist themself.

Actual Behavior

After filling all the required stuff and double-checking the tutorial to fill what the mods needs, I got no answers from the bot even being on the server and working just fine with other mods such as Discord Integration and etc.

The only thing in logs I found is

[02:50:37] [AutoWhitelist Bot/ERROR]: Caught previously unhandled exception :
[02:50:37] [AutoWhitelist Bot/ERROR]: AutoWhitelist Bot
java.lang.NoClassDefFoundError: Could not initialize class okhttp3.internal.Util
        at okhttp3.Dispatcher.promoteAndExecute(Dispatcher.kt:243) ~[com_squareup_okhttp3_okhttp-4.9.3-55e600239ceac930.jar:?]
        at okhttp3.Dispatcher.setMaxRequestsPerHost(Dispatcher.kt:71) ~[com_squareup_okhttp3_okhttp-4.9.3-55e600239ceac930.jar:?]
        at net.dv8tion.jda.internal.utils.IOUtil.newHttpClientBuilder(IOUtil.java:72) ~[net_dv8tion_jda-4.4.0_352-525c9f524e1d024d.jar:?]
        at net.dv8tion.jda.api.JDABuilder.build(JDABuilder.java:1833) ~[net_dv8tion_jda-4.4.0_352-525c9f524e1d024d.jar:?]
        at com.awakenedredstone.autowhitelist.discord.Bot.run(Bot.java:115) ~[autowhitelist-1.1.2.jar:?]

Reproduction Steps

  1. Install AutoWhitelister 1.1.2 from Modrinth for 1.19.2-1.19.3.
  2. Fill all the required info into config, let the server restart to launch the mod. (I tried both reloading using commands and simply restarting the server with saved changes)
  3. Get no response from the bot and /autowhitelist reload bot throwing a similar error: (and this error also prints on each server start)
    [02:50:37] [AutoWhitelist Bot/ERROR]: Caught previously unhandled exception :
    [02:50:37] [AutoWhitelist Bot/ERROR]: AutoWhitelist Bot
    java.lang.NoClassDefFoundError: Could not initialize class okhttp3.internal.Util
        at okhttp3.Dispatcher.promoteAndExecute(Dispatcher.kt:243) ~[com_squareup_okhttp3_okhttp-4.9.3-55e600239ceac930.jar:?]
        at okhttp3.Dispatcher.setMaxRequestsPerHost(Dispatcher.kt:71) ~[com_squareup_okhttp3_okhttp-4.9.3-55e600239ceac930.jar:?]
        at net.dv8tion.jda.internal.utils.IOUtil.newHttpClientBuilder(IOUtil.java:72) ~[net_dv8tion_jda-4.4.0_352-525c9f524e1d024d.jar:?]
        at net.dv8tion.jda.api.JDABuilder.build(JDABuilder.java:1833) ~[net_dv8tion_jda-4.4.0_352-525c9f524e1d024d.jar:?]
        at com.awakenedredstone.autowhitelist.discord.Bot.run(Bot.java:115) ~[autowhitelist-1.1.2.jar:?]
  4. Get scared by this stuff at the console 😢

Java version

Java 17

Additional information

Fabric Loader: 0.14.11 Fabric API: 0.70.0 (a bit outdated, yeah, I know, but still reproducible on newer versions) Fabric Language Kotlin: 1.8.7+kotlin.1.7.22

Also there are a bunch of mods, but I managed to reproduce that with only Fabric API and Fabric Language Kotlin.

Feel free to ask questions or some more info for that. Let me know if I missed something. Thank you in advance. :)

DenisMasterHerobrine commented 1 year ago

Also to mention: tried to test compatibility jars, they acted nearly the same but thrown a bit strange okhttp3 exceptions, such as:

java.lang.NoClassDefFoundError: Could not initialize class okhttp3.internal.Util
        at okhttp3.Dispatcher.promoteAndExecute(Dispatcher.kt:243) ~[com_squareup_okhttp3_okhttp-4.9.3-24e151318a797236.jar:?]
        at okhttp3.Dispatcher.setMaxRequestsPerHost(Dispatcher.kt:71) ~[com_squareup_okhttp3_okhttp-4.9.3-24e151318a797236.jar:?]
        at net.dv8tion.jda.internal.utils.IOUtil.newHttpClientBuilder(IOUtil.java:107) ~[net_dv8tion_jda-5.0.0-alpha.22-8b3835233daaf44c.jar:?]
        at net.dv8tion.jda.api.JDABuilder.build(JDABuilder.java:1762) ~[net_dv8tion_jda-5.0.0-alpha.22-8b3835233daaf44c.jar:?]
        at com.awakenedredstone.autowhitelist.discord.Bot.run(Bot.java:117) ~[autowhitelist-1.1.2-compat-mcdiscordchat.2.1.0.jar:?]

Literally no idea, since I had multiple mods tried out already to find out something like AutoWhitelister and they all worked fine, so I don't think that the issue is about rate limiting or something like that.

DenisMasterHerobrine commented 1 year ago

Solved the issue, the root of the problem was in a broken dependency after removing DeftuLib. The reason that okhttp3 lib being used twice, AutoWhitelist being using 4.9.3 version instead of 3.13.0. So technically this issue can solved by removing DeftuLib mod or force the okhttp3 dependency in build.gradle

Awakened-Redstone commented 1 year ago

Oh yeah, that issue should be fixed on newer versions, but I'll try to do a hotfix for 1.1.2 later to patch that