Mc2Discord

Mc2Discord

50.4k Downloads

ClassLoader Issue

LenTheNinja opened this issue ยท 5 comments

commented

Possible ClassLoader issue?

Server Logs on startup are showing java.lang.ClassNotFoundException for multiple classes within the minecraft2discord-forge-1.16.3.-2.0.4.jar on server: forge-1.16.3-34.1.0.jar

Six Mods in use:
blame-1.16.3-1.4.3.jar
corpse-1.16.3-1.0.5.jar
jei-1.16.3-7.6.0.45.jar
minecraft2discord-forge-1.16.3-2.0.4.jar
Xaeros_Minimap_20.25.1_Forge_1.16.3.jar
Xaeros_WorldMap_1.11.0_Forge_1.16.3.jar

I can navigate to the classes within the JAR file, but server is unable to locate the class files. Attempted re-download of jar file and replaced into mods folder, same result.

Part of the mod is working, the bot logs in and announces server startup and server stop in Discord.

openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)

See attached log:

[12Oct2020 12:35:17.321] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer/]: Done (2.179s)! For help, type "help" [12Oct2020 12:35:20.729] [Server thread/INFO] [STDERR/]: [ml.denisd3d.repack.org.slf4j.impl.SimpleLogger:write:318]: [Server thread] INFO ml.denisd3d.repack.net.dv8tion.jda.api.JDA - Login Successful! [12Oct2020 12:35:21.044] [JDA MainWS-ReadThread/INFO] [STDERR/]: [ml.denisd3d.repack.org.slf4j.impl.SimpleLogger:write:318]: [JDA MainWS-ReadThread] INFO ml.denisd3d.repack.net.dv8tion.jda.internal.requests.WebSocketClient - Connected to WebSocket [12Oct2020 12:35:21.314] [JDA MainWS-ReadThread/INFO] [STDERR/]: [ml.denisd3d.repack.org.slf4j.impl.SimpleLogger:write:318]: [JDA MainWS-ReadThread] INFO ml.denisd3d.repack.net.dv8tion.jda.api.JDA - Finished Loading! [12Oct2020 12:35:21.340] [JDA MainWS-ReadThread/INFO] [ml.denisd3d.minecraft2discord.Minecraft2Discord/]: Discord bot logged as MinecraftServerMonitor [12Oct2020 12:35:21.481] [ForkJoinPool.commonPool-worker-9/ERROR] [net.minecraftforge.eventbus.EventSubclassTransformer/EVENTBUS]: Could not find parent ml/denisd3d/repack/net/dv8tion/jda/internal/entities/AbstractMessage for class ml/denisd3d/repack/net/dv8tion/jda/internal/entities/DataMessage in classloader sun.misc.Launcher$AppClassLoader@232204a1 on thread Thread[ForkJoinPool.commonPool-worker-9,5,main] [12Oct2020 12:35:21.548] [ForkJoinPool.commonPool-worker-9/ERROR] [net.minecraftforge.eventbus.EventSubclassTransformer/EVENTBUS]: An error occurred building event handler java.lang.ClassNotFoundException: ml.denisd3d.repack.net.dv8tion.jda.internal.entities.AbstractMessage at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[?:1.8.0_265] at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[?:1.8.0_265] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) ~[?:1.8.0_265] at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_265] at net.minecraftforge.eventbus.EventSubclassTransformer.buildEvents(EventSubclassTransformer.java:62) ~[eventbus-3.0.3-service.jar:?] at net.minecraftforge.eventbus.EventSubclassTransformer.transform(EventSubclassTransformer.java:44) ~[eventbus-3.0.3-service.jar:?] at net.minecraftforge.eventbus.EventBusEngine.processClass(EventBusEngine.java:21) ~[eventbus-3.0.3-service.jar:?] at net.minecraftforge.eventbus.service.ModLauncherService.processClassWithFlags(ModLauncherService.java:20) ~[eventbus-3.0.3-service.jar:3.0.3+63+master.b6b4769] at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:85) ~[modlauncher-7.0.1.jar:?] at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:119) ~[modlauncher-7.0.1.jar:?] at cpw.mods.modlauncher.TransformingClassLoader$DelegatedClassLoader.findClass(TransformingClassLoader.java:256) ~[modlauncher-7.0.1.jar:?] at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:135) ~[modlauncher-7.0.1.jar:?] at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:97) ~[modlauncher-7.0.1.jar:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_265] at ml.denisd3d.repack.net.dv8tion.jda.api.MessageBuilder.build(MessageBuilder.java:1179) ~[?:?] at ml.denisd3d.minecraft2discord.managers.MessageManager.sendTheMessage(MessageManager.java:75) ~[?:?] at ml.denisd3d.minecraft2discord.managers.MessageManager.sendMessage(MessageManager.java:44) ~[?:?] at ml.denisd3d.minecraft2discord.managers.MessageManager.sendMessage(MessageManager.java:86) ~[?:?] at ml.denisd3d.minecraft2discord.managers.MessageManager.sendFormattedMessage(MessageManager.java:111) ~[?:?] at ml.denisd3d.minecraft2discord.events.DiscordEvents.sendStartMessage(DiscordEvents.java:40) ~[?:?] at ml.denisd3d.minecraft2discord.managers.WebhookManager.addWebhookClient(WebhookManager.java:24) ~[?:?] at ml.denisd3d.minecraft2discord.events.DiscordEvents.lambda$onReady$0(DiscordEvents.java:53) ~[?:?] at ml.denisd3d.minecraft2discord.managers.WebhookManager.lambda$addWebhookClient$4(WebhookManager.java:59) ~[?:?] at ml.denisd3d.repack.net.dv8tion.jda.api.requests.Request.lambda$onSuccess$0(Request.java:95) ~[?:?] at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402) [?:1.8.0_265] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [?:1.8.0_265] at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [?:1.8.0_265] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [?:1.8.0_265] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) [?:1.8.0_265] [12Oct2020 12:35:21.562] [ForkJoinPool.commonPool-worker-9/ERROR] [net.minecraftforge.eventbus.EventSubclassTransformer/EVENTBUS]: Could not find parent ml/denisd3d/repack/net/dv8tion/jda/internal/requests/RestActionImpl for class ml/denisd3d/repack/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl in classloader sun.misc.Launcher$AppClassLoader@232204a1 on thread Thread[ForkJoinPool.commonPool-worker-9,5,main] [12Oct2020 12:35:21.566] [ForkJoinPool.commonPool-worker-9/ERROR] [net.minecraftforge.eventbus.EventSubclassTransformer/EVENTBUS]: An error occurred building event handler java.lang.ClassNotFoundException: ml.denisd3d.repack.net.dv8tion.jda.internal.requests.RestActionImpl at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[?:1.8.0_265] at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[?:1.8.0_265] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) ~[?:1.8.0_265] at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_265] at net.minecraftforge.eventbus.EventSubclassTransformer.buildEvents(EventSubclassTransformer.java:62) ~[eventbus-3.0.3-service.jar:?] at net.minecraftforge.eventbus.EventSubclassTransformer.transform(EventSubclassTransformer.java:44) ~[eventbus-3.0.3-service.jar:?] at net.minecraftforge.eventbus.EventBusEngine.processClass(EventBusEngine.java:21) ~[eventbus-3.0.3-service.jar:?] at net.minecraftforge.eventbus.service.ModLauncherService.processClassWithFlags(ModLauncherService.java:20) ~[eventbus-3.0.3-service.jar:3.0.3+63+master.b6b4769] at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:85) ~[modlauncher-7.0.1.jar:?] at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:119) ~[modlauncher-7.0.1.jar:?] at cpw.mods.modlauncher.TransformingClassLoader$DelegatedClassLoader.findClass(TransformingClassLoader.java:256) ~[modlauncher-7.0.1.jar:?] at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:135) ~[modlauncher-7.0.1.jar:?] at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:97) ~[modlauncher-7.0.1.jar:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_265] at ml.denisd3d.repack.net.dv8tion.jda.api.entities.MessageChannel.sendMessage(MessageChannel.java:502) ~[?:?] at ml.denisd3d.repack.net.dv8tion.jda.internal.entities.TextChannelImpl.sendMessage(TextChannelImpl.java:366) ~[?:?] at ml.denisd3d.minecraft2discord.managers.MessageManager.sendTheMessage(MessageManager.java:75) ~[?:?] at ml.denisd3d.minecraft2discord.managers.MessageManager.sendMessage(MessageManager.java:44) ~[?:?] at ml.denisd3d.minecraft2discord.managers.MessageManager.sendMessage(MessageManager.java:86) ~[?:?] at ml.denisd3d.minecraft2discord.managers.MessageManager.sendFormattedMessage(MessageManager.java:111) ~[?:?] at ml.denisd3d.minecraft2discord.events.DiscordEvents.sendStartMessage(DiscordEvents.java:40) ~[?:?] at ml.denisd3d.minecraft2discord.managers.WebhookManager.addWebhookClient(WebhookManager.java:24) ~[?:?] at ml.denisd3d.minecraft2discord.events.DiscordEvents.lambda$onReady$0(DiscordEvents.java:53) ~[?:?] at ml.denisd3d.minecraft2discord.managers.WebhookManager.lambda$addWebhookClient$4(WebhookManager.java:59) ~[?:?] at ml.denisd3d.repack.net.dv8tion.jda.api.requests.Request.lambda$onSuccess$0(Request.java:95) ~[?:?] at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402) [?:1.8.0_265] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [?:1.8.0_265] at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [?:1.8.0_265] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [?:1.8.0_265] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) [?:1.8.0_265] [12Oct2020 12:35:21.586] [ForkJoinPool.commonPool-worker-9/ERROR] [net.minecraftforge.eventbus.EventSubclassTransformer/EVENTBUS]: Could not find parent ml/denisd3d/repack/okhttp3/RequestBody for class ml/denisd3d/repack/okhttp3/MultipartBody in classloader sun.misc.Launcher$AppClassLoader@232204a1 on thread Thread[ForkJoinPool.commonPool-worker-9,5,main] [12Oct2020 12:35:21.619] [ForkJoinPool.commonPool-worker-9/ERROR] [net.minecraftforge.eventbus.EventSubclassTransformer/EVENTBUS]: An error occurred building event handler java.lang.ClassNotFoundException: ml.denisd3d.repack.okhttp3.RequestBody at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[?:1.8.0_265] at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[?:1.8.0_265] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) ~[?:1.8.0_265] at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_265] at net.minecraftforge.eventbus.EventSubclassTransformer.buildEvents(EventSubclassTransformer.java:62) ~[eventbus-3.0.3-service.jar:?] at net.minecraftforge.eventbus.EventSubclassTransformer.transform(EventSubclassTransformer.java:44) ~[eventbus-3.0.3-service.jar:?] at net.minecraftforge.eventbus.EventBusEngine.processClass(EventBusEngine.java:21) ~[eventbus-3.0.3-service.jar:?] at net.minecraftforge.eventbus.service.ModLauncherService.processClassWithFlags(ModLauncherService.java:20) ~[eventbus-3.0.3-service.jar:3.0.3+63+master.b6b4769] at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:85) ~[modlauncher-7.0.1.jar:?] at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:119) ~[modlauncher-7.0.1.jar:?] at cpw.mods.modlauncher.TransformingClassLoader$DelegatedClassLoader.findClass(TransformingClassLoader.java:256) ~[modlauncher-7.0.1.jar:?] at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:135) ~[modlauncher-7.0.1.jar:?] at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:97) ~[modlauncher-7.0.1.jar:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_265] at ml.denisd3d.repack.net.dv8tion.jda.api.entities.MessageChannel.sendMessage(MessageChannel.java:502) ~[?:?] at ml.denisd3d.repack.net.dv8tion.jda.internal.entities.TextChannelImpl.sendMessage(TextChannelImpl.java:366) ~[?:?] at ml.denisd3d.minecraft2discord.managers.MessageManager.sendTheMessage(MessageManager.java:75) ~[?:?] at ml.denisd3d.minecraft2discord.managers.MessageManager.sendMessage(MessageManager.java:44) ~[?:?] at ml.denisd3d.minecraft2discord.managers.MessageManager.sendMessage(MessageManager.java:86) ~[?:?] at ml.denisd3d.minecraft2discord.managers.MessageManager.sendFormattedMessage(MessageManager.java:111) ~[?:?] at ml.denisd3d.minecraft2discord.events.DiscordEvents.sendStartMessage(DiscordEvents.java:40) ~[?:?] at ml.denisd3d.minecraft2discord.managers.WebhookManager.addWebhookClient(WebhookManager.java:24) ~[?:?] at ml.denisd3d.minecraft2discord.events.DiscordEvents.lambda$onReady$0(DiscordEvents.java:53) ~[?:?] at ml.denisd3d.minecraft2discord.managers.WebhookManager.lambda$addWebhookClient$4(WebhookManager.java:59) ~[?:?] at ml.denisd3d.repack.net.dv8tion.jda.api.requests.Request.lambda$onSuccess$0(Request.java:95) ~[?:?] at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402) [?:1.8.0_265] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [?:1.8.0_265] at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [?:1.8.0_265] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [?:1.8.0_265] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) [?:1.8.0_265]

commented

Hi, that's a really strange issue !
Did you enabled / disabled anything in the config ?
Are you on the last forge version ?
Denis

commented

On the latest Recommended Forge 1.16.3 - 34.1.0

It worked without error last night, I restarted the server today as I am changing the world seed. Restarted the server and received the stack trace and noticed that the chat from inside minecraft does not relay, but the status messages do. Last night all functions were working. This is very strange to me as well, as the NoClassDef usually points to a build with dependency or Classpath issue. Are there any expected classpath settings needed for the mod?

I removed most of the comments for Brevity and removed my token / discord server for security, but here is the rest of my config:

`
[Discord]
# Token of the discord bot
token = "removed_for_security"

# Discord Channels Ids
[Discord.Channels]
	chat = 764941471177506840
	info = 764941471177506840

Messages settings

[Messages]

# Join & leave settings
[Messages.JoinLeave]
	
	leave = "${player_name} left the game."
	join = "${player_name} joined the game."
	enabled = true

[Messages.StartStop]
	stop = "The server has stopped."
	start = "The server has started."
	enabled = true
	crash = "The server has crashed."

[Messages.Death]
	message = "${death_message}"
	enabled = true

[Messages.Advancement]
	hiddenAdvancementsList = []
	message = "${player_name} has made the advancement ${advancement_title}. ${advancement_description}."
	enabled = true

[Status]

[Status.ChannelName]
	channel = 764941471177506840
	updatePeriod = 610
	message = "Players : ${global_online_players} / ${global_max_players}"
	# Enable channel name update
	enabled = false

[Status.Presence]
	updatePeriod = 60
	message = "${global_online_players} / ${global_max_players} players"
	enabled = true

[Status.Topic]
	channel = 764941471177506840
	updatePeriod = 610
	message = "${global_online_players} / ${global_max_players} players"
	# Enable topic update
	enabled = false

[Commands]

[Commands.DiscordCommand]
	link = "https://discord.gg/changed_for_security"
	enabled = false


[Commands.CommandsIntegration]
	commandAllowedRolesIds = []
	codeblocksEnabled = true
	prefix = "/"
	commandAllowedUsersIds = []
	errorMessage = "You don't have enough permission or the command doesn't exist"
	allowedCommandForEveryone = ["help"]

[Webhooks]

avatarAPI = "https://mc-heads.net/head/${player_name}"
nameFormat = "${player_name}"
# Enable the use of webhooks (customized profile picture and name)
enabled = false
disabledFormat = "**${player_name}** : ${message}"


[Webhooks.Server]
	avatarURL = ""
	name = ""

[Miscellaneous]
nicknameEnabled = true
mentionsEnabled = false
botMessageRelayEnabled = true

Variables settings

[Variables]
chatFormat = "<Discord - ${discord_user_name}> "
dateFormat = "yyyy-MM-dd HH:mm:ss"
uptimeFormat = "HH:mm"`

commented

I think you can close this. I am not sure what exactly fixed it, but here is what I did:

  1. Deleted Worlds folder and I moved all my mods out of the .minecraft/mods folder
  2. Deleted the files for the mods out of the .minecraft/config directory
  3. Loaded only minecraft2discord.jar into mods folder with my config file in config folder
  4. Start Server - Everything works
  5. Stop Server -> Load another mod, Start Server -> All Working
  6. Rinse and Repeat for every mod, Everything is working.

It must have been something in my world folder or a different mods config file that caused the issue. Just strange that it caused the class loader for minecraft2discord to mess up and no other classes.

Again, I am using all the same jar files again and now it works /cheers

Log sample, logs now clean

[21:03:12] [Server thread/INFO] [minecraft/DedicatedServer]: Done (9.373s)! For help, type "help" [21:03:14] [Server thread/INFO] [STDERR/]: [ml.denisd3d.repack.org.slf4j.impl.SimpleLogger:write:318]: [Server thread] INFO ml.denisd3d.repack.net.dv8tion.jda.api.JDA - Login Successful! [21:03:14] [JDA MainWS-ReadThread/INFO] [STDERR/]: [ml.denisd3d.repack.org.slf4j.impl.SimpleLogger:write:318]: [JDA MainWS-ReadThread] INFO ml.denisd3d.repack.net.dv8tion.jda.internal.requests.WebSocketClient - Connected to WebSocket [21:03:14] [JDA MainWS-ReadThread/INFO] [STDERR/]: [ml.denisd3d.repack.org.slf4j.impl.SimpleLogger:write:318]: [JDA MainWS-ReadThread] INFO ml.denisd3d.repack.net.dv8tion.jda.api.JDA - Finished Loading! [21:03:14] [JDA MainWS-ReadThread/INFO] [ml.de.mi.Minecraft2Discord/]: Discord bot logged as MinecraftServerMonitor [21:03:21] [JDA MainWS-ReadThread/INFO] [minecraft/DedicatedServer]: <Discord - Obfuscated> test

commented

Yeah thats' really strange... Another question because it's an issue reported on the discord : Did you experience any high cpu and ram usage using the last m2d version ? (something that wasn't there on previous versions)

commented

Issue is fixed in 2.0.5 update