Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin tries to find Bukkit classes when running on velocity #210

Closed
comjun04 opened this issue May 12, 2024 · 7 comments
Closed

Plugin tries to find Bukkit classes when running on velocity #210

comjun04 opened this issue May 12, 2024 · 7 comments

Comments

@comjun04
Copy link

Hello,
When joining to the proxy for the first time after startup, the plugin throws error about trying to find Bukkit class on velocity platform.

[16:58:02 INFO]: Listening on /[0:0:0:0:0:0:0:0]:25565
[16:58:02 INFO]: Done (5.26s)!
[16:58:05 INFO]: [connected player] comjun04 (/127.0.0.1:59327) has connected
[16:58:05 INFO]: [server connection] comjun04 -> main has connected
[16:58:05 ERROR]: Exception in thread "InteractiveChatVelocity Async Backend Server Ping Thread #0" java.lang.NoClassDefFoundError: org/bukkit/plugin/java/JavaPlugin
[16:58:05 ERROR]:       at java.base/java.lang.ClassLoader.defineClass1(Native Method)
[16:58:05 ERROR]:       at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
[16:58:05 ERROR]:       at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
[16:58:05 ERROR]:       at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
[16:58:05 ERROR]:       at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
[16:58:05 ERROR]:       at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
[16:58:05 ERROR]:       at java.base/java.security.AccessController.doPrivileged(AccessController.java:714)
[16:58:05 ERROR]:       at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
[16:58:05 ERROR]:       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
[16:58:05 ERROR]:       at com.velocitypowered.proxy.plugin.PluginClassLoader.loadClass0(PluginClassLoader.java:70)
[16:58:05 ERROR]:       at com.velocitypowered.proxy.plugin.PluginClassLoader.loadClass(PluginClassLoader.java:64)
[16:58:05 ERROR]:       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
[16:58:05 ERROR]:       at com.loohp.interactivechat.utils.InteractiveChatComponentSerializer.lambda$static$0(InteractiveChatComponentSerializer.java:84)
[16:58:05 ERROR]:       at com.loohp.interactivechat.libs.net.kyori.adventure.text.serializer.gson.GsonComponentSerializerImpl$BuilderImpl.editOptions(GsonComponentSerializerImpl.java:148)
[16:58:05 ERROR]:       at com.loohp.interactivechat.utils.InteractiveChatComponentSerializer.<clinit>(InteractiveChatComponentSerializer.java:80)
[16:58:05 ERROR]:       at com.loohp.interactivechat.proxy.velocity.ServerPingVelocity.lambda$getPing$0(ServerPingVelocity.java:143)
[16:58:05 ERROR]:       at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[16:58:05 ERROR]:       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[16:58:05 ERROR]:       at java.base/java.lang.Thread.run(Thread.java:1583)
[16:58:05 ERROR]: Caused by: java.lang.ClassNotFoundException: org.bukkit.plugin.java.JavaPlugin
[16:58:05 ERROR]:       at com.velocitypowered.proxy.plugin.PluginClassLoader.loadClass0(PluginClassLoader.java:87)
[16:58:05 ERROR]:       at com.velocitypowered.proxy.plugin.PluginClassLoader.loadClass(PluginClassLoader.java:64)
[16:58:05 ERROR]:       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
[16:58:05 ERROR]:       ... 19 more

Running /icp throws additional errors:

[18:06:49 INFO]: Exception occurred while running command for comjun04
java.util.concurrent.CompletionException: java.lang.RuntimeException: Unable to invoke command icp for [connected player] comjun04 (/127.0.0.1:59327)
        at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?]
        at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?]
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770) ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
Caused by: java.lang.RuntimeException: Unable to invoke command icp for [connected player] comjun04 (/127.0.0.1:59327)
        at com.velocitypowered.proxy.command.VelocityCommandManager.executeImmediately0(VelocityCommandManager.java:252) ~[server.jar:3.3.0-SNAPSHOT (git-afd8b55f-b390)]
        at com.velocitypowered.proxy.command.VelocityCommandManager.lambda$executeImmediatelyAsync$1(VelocityCommandManager.java:279) ~[server.jar:3.3.0-SNAPSHOT (git-afd8b55f-b390)]
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        ... 3 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.loohp.interactivechat.utils.InteractiveChatComponentSerializer
        at com.loohp.interactivechat.utils.NativeAdventureConverter.componentToNative(NativeAdventureConverter.java:163) ~[?:?]
        at com.loohp.interactivechat.utils.NativeAdventureConverter.sendNativeAudienceMessage(NativeAdventureConverter.java:246) ~[?:?]
        at com.loohp.interactivechat.proxy.velocity.InteractiveChatVelocity.sendMessage(InteractiveChatVelocity.java:215) ~[?:?]
        at com.loohp.interactivechat.proxy.velocity.CommandsVelocity.defaultMessage(CommandsVelocity.java:107) ~[?:?]
        at com.loohp.interactivechat.proxy.velocity.CommandsVelocity.lambda$createBrigadierCommand$5(CommandsVelocity.java:93) ~[?:?]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:262) ~[server.jar:3.3.0-SNAPSHOT (git-afd8b55f-b390)]
        at com.velocitypowered.proxy.command.VelocityCommandManager.executeImmediately0(VelocityCommandManager.java:230) ~[server.jar:3.3.0-SNAPSHOT (git-afd8b55f-b390)]
        at com.velocitypowered.proxy.command.VelocityCommandManager.lambda$executeImmediatelyAsync$1(VelocityCommandManager.java:279) ~[server.jar:3.3.0-SNAPSHOT (git-afd8b55f-b390)]
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        ... 3 more
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: org/bukkit/plugin/java/JavaPlugin [in thread "InteractiveChatVelocity Async Backend Server Ping Thread #0"]
        at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027) ~[?:?]
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) ~[?:?]
        at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524) ~[?:?]
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427) ~[?:?]
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421) ~[?:?]
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:714) ~[?:?]
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420) ~[?:?]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593) ~[?:?]
        at com.velocitypowered.proxy.plugin.PluginClassLoader.loadClass0(PluginClassLoader.java:70) ~[server.jar:3.3.0-SNAPSHOT (git-afd8b55f-b390)]
        at com.velocitypowered.proxy.plugin.PluginClassLoader.loadClass(PluginClassLoader.java:64) ~[server.jar:3.3.0-SNAPSHOT (git-afd8b55f-b390)]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
        at com.loohp.interactivechat.utils.InteractiveChatComponentSerializer.lambda$static$0(InteractiveChatComponentSerializer.java:84) ~[?:?]
        at com.loohp.interactivechat.libs.net.kyori.adventure.text.serializer.gson.GsonComponentSerializerImpl$BuilderImpl.editOptions(GsonComponentSerializerImpl.java:148) ~[?:?]
        at com.loohp.interactivechat.utils.InteractiveChatComponentSerializer.<clinit>(InteractiveChatComponentSerializer.java:80) ~[?:?]
        at com.loohp.interactivechat.proxy.velocity.ServerPingVelocity.lambda$getPing$0(ServerPingVelocity.java:143) ~[?:?]
        ... 3 more

I've tested this on velocity 3.3.0-SNAPSHOT-b390. Running plugin on papermc works fine.

@LOOHP LOOHP closed this as completed in 1fa7c51 May 12, 2024
@LOOHP
Copy link
Owner

LOOHP commented May 12, 2024

Can you give build #272 a try?

@comjun04
Copy link
Author

Can you give build #272 a try?

Still has same error... tested build #272 and #276 (latest dev build as of writing)

[01:08:57 INFO]: Listening on /[0:0:0:0:0:0:0:0]:25565
[01:08:57 INFO]: Done (4.95s)!
[01:09:00 INFO]: [connected player] comjun04 (/127.0.0.1:49161) has connected
[01:09:00 INFO]: [server connection] comjun04 -> main has connected
[01:09:01 ERROR]: Exception in thread "InteractiveChatVelocity Async Backend Server Ping Thread #0" java.lang.NoClassDefFoundError: org/bukkit/plugin/java/JavaPlugin
[01:09:01 ERROR]:       at java.base/java.lang.ClassLoader.defineClass1(Native Method)
[01:09:01 ERROR]:       at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
[01:09:01 ERROR]:       at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
[01:09:01 ERROR]:       at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
[01:09:01 ERROR]:       at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
[01:09:01 ERROR]:       at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
[01:09:01 ERROR]:       at java.base/java.security.AccessController.doPrivileged(AccessController.java:714)
[01:09:01 ERROR]:       at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
[01:09:01 ERROR]:       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
[01:09:01 ERROR]:       at com.velocitypowered.proxy.plugin.PluginClassLoader.loadClass0(PluginClassLoader.java:70)
[01:09:01 ERROR]:       at com.velocitypowered.proxy.plugin.PluginClassLoader.loadClass(PluginClassLoader.java:64)
[01:09:01 ERROR]:       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
[01:09:01 ERROR]:       at com.loohp.interactivechat.utils.InteractiveChatComponentSerializer.lambda$static$0(InteractiveChatComponentSerializer.java:85)
[01:09:01 ERROR]:       at com.loohp.interactivechat.libs.net.kyori.adventure.text.serializer.gson.GsonComponentSerializerImpl$BuilderImpl.editOptions(GsonComponentSerializerImpl.java:148)
[01:09:01 ERROR]:       at com.loohp.interactivechat.utils.InteractiveChatComponentSerializer.<clinit>(InteractiveChatComponentSerializer.java:80)
[01:09:01 ERROR]:       at com.loohp.interactivechat.proxy.velocity.ServerPingVelocity.lambda$getPing$0(ServerPingVelocity.java:143)
[01:09:01 ERROR]:       at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[01:09:01 ERROR]:       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[01:09:01 ERROR]:       at java.base/java.lang.Thread.run(Thread.java:1583)
[01:09:01 ERROR]: Caused by: java.lang.ClassNotFoundException: org.bukkit.plugin.java.JavaPlugin
[01:09:01 ERROR]:       at com.velocitypowered.proxy.plugin.PluginClassLoader.loadClass0(PluginClassLoader.java:87)
[01:09:01 ERROR]:       at com.velocitypowered.proxy.plugin.PluginClassLoader.loadClass(PluginClassLoader.java:64)
[01:09:01 ERROR]:       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
[01:09:01 ERROR]:       ... 19 more

@LOOHP LOOHP reopened this May 13, 2024
@LOOHP LOOHP closed this as completed in a6262b7 May 13, 2024
@LOOHP
Copy link
Owner

LOOHP commented May 13, 2024

Can you try build #277 to see if it is fixed?

@comjun04
Copy link
Author

Sorry for the late reply. Build #277 does not throw error on startup anymore.
But it throws error when running /icp or any other commands on proxy on first time after startup.

[20:44:15 ERROR]: Exception in thread "Timer-0" java.lang.IllegalArgumentException: Can not set com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder field com.velocitypowered.proxy.protocol.packet.chat.SystemChatPacket.component to net.kyori.adventure.text.TextComponentImpl
[20:44:15 ERROR]:       at java.base/jdk.internal.reflect.FieldAccessorImpl.throwSetIllegalArgumentException(FieldAccessorImpl.java:228)
[20:44:15 ERROR]:       at java.base/jdk.internal.reflect.FieldAccessorImpl.throwSetIllegalArgumentException(FieldAccessorImpl.java:232)
[20:44:15 ERROR]:       at java.base/jdk.internal.reflect.MethodHandleObjectFieldAccessorImpl.set(MethodHandleObjectFieldAccessorImpl.java:115)
[20:44:15 ERROR]:       at java.base/java.lang.reflect.Field.set(Field.java:836)
[20:44:15 ERROR]:       at com.loohp.interactivechat.proxy.velocity.InteractiveChatVelocity.lambda$onProxyInitialization$4(InteractiveChatVelocity.java:304)
[20:44:15 ERROR]:       at com.loohp.interactivechat.proxy.objectholders.ProxyMessageForwardingHandler$1.run(ProxyMessageForwardingHandler.java:120)
[20:44:15 ERROR]:       at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
[20:44:15 ERROR]:       at java.base/java.util.TimerThread.run(Timer.java:516)

After this error, any proxy command that prints some text won't print anything when used on player chat (e.g. /icp, /velocity info. running on console works fine and prints text normally)

@LOOHP
Copy link
Owner

LOOHP commented May 15, 2024

Which version of velocity are you using?

@comjun04
Copy link
Author

comjun04 commented May 16, 2024

Which version of velocity are you using?

Currently using 3.3.0-SNAPSHOT-390.

@LOOHP
Copy link
Owner

LOOHP commented May 16, 2024

ca874ad might be able to fix the issues you are having.
However, it won't work fully until dmulloy2/ProtocolLib#2933 is merged in ProtocolLib, if you are on 1.20+.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants