pdinklag / MinecraftStats

A Minecraft player statistics browser for the web - supports 1.13 and later!
https://discord.gg/brH5PGG8By
Other
228 stars 53 forks source link

[Bug] java.lang.NoClassDefFoundError: net/skinsrestorer/api/SkinsRestorerAPI #240

Open wling-art opened 8 months ago

wling-art commented 8 months ago
[08:37:09] [Craft Scheduler Thread - 12 - MinecraftStats/WARN]: [MinecraftStats] Plugin MinecraftStats v3.2.1 generated an exception while executing task 1049
java.lang.NoClassDefFoundError: net/skinsrestorer/api/SkinsRestorerAPI
    at de.pdinklag.mcstats.bukkit.SkinsRestorerProfileProvider.<init>(SkinsRestorerProfileProvider.java:15) ~[[M][WEB统计]MinecraftStats.jar:?]
    at de.pdinklag.mcstats.bukkit.BukkitUpdater.getAuthenticProfileProvider(BukkitUpdater.java:47) ~[[M][WEB统计]MinecraftStats.jar:?]
    at de.pdinklag.mcstats.Updater.run(Updater.java:352) ~[[M][WEB统计]MinecraftStats.jar:?]
    at de.pdinklag.mcstats.bukkit.BukkitUpdater.run(BukkitUpdater.java:71) ~[[M][WEB统计]MinecraftStats.jar:?]
    at de.pdinklag.mcstats.bukkit.BukkitUpdateTask.run(BukkitUpdateTask.java:17) ~[[M][WEB统计]MinecraftStats.jar:?]
    at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.20.2.jar:git-Purpur-2095]
    at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.20.2.jar:git-Purpur-2095]
    at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.20.2.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
    at java.lang.Thread.run(Thread.java:840) ~[?:?]
Caused by: java.lang.ClassNotFoundException: net.skinsrestorer.api.SkinsRestorerAPI
    at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:199) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:166) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
    ... 11 more
pdinklag commented 8 months ago

I'm gonna need more info here. I suppose you have Skins Restorer installed, but apparently a version without an API. Either an old one or something major has changed in a newer version.

What version of Skins Restorer are you using?

wling-art commented 8 months ago

I'm gonna need more info here. I suppose you have Skins Restorer installed, but apparently a version without an API. Either an old one or something major has changed in a newer version.

What version of Skins Restorer are you using?

latest: 15.0.6

I think it's the new version of Skins Restorer API but the plugin isn't adapted, right?

pdinklag commented 8 months ago

是一个没有 API 的版本。在较新的版本中,旧的或重大的更改。 您使用的是哪个版本的

latest: 15.0.6

I think it's the new version of Skins Restorer API but the plugin isn't adapted, right?

I didn't adapt anything.

Apparently, according to their documentation, they changed the class name from SkinsRestorerAPI to just SkinsRestorer. I could not find out when they changed it. That is very unfortunate project management on their side, these kinds of changes break every and all plugins that use the API and make it unnecessarily complicated to support different versions...

But thank you for noting, I will have to adapt MinecraftStats for it.

Athar42 commented 3 months ago

I'm doing a little "bump" on this one, as it seems to not be published yet... so I still post my log output just in case, but seems the same as the original author :

[23:14:14 WARN]: [MinecraftStats] Plugin MinecraftStats v3.3.0 generated an exception while executing task 64
java.lang.NoClassDefFoundError: net/skinsrestorer/api/SkinsRestorerAPI
        at de.pdinklag.mcstats.bukkit.SkinsRestorerProfileProvider.<init>(SkinsRestorerProfileProvider.java:15) ~[MinecraftStats-3.3.0.jar:?]
        at de.pdinklag.mcstats.bukkit.BukkitUpdater.getAuthenticProfileProvider(BukkitUpdater.java:47) ~[MinecraftStats-3.3.0.jar:?]
        at de.pdinklag.mcstats.Updater.run(Updater.java:368) ~[MinecraftStats-3.3.0.jar:?]
        at de.pdinklag.mcstats.bukkit.BukkitUpdater.run(BukkitUpdater.java:71) ~[MinecraftStats-3.3.0.jar:?]
        at de.pdinklag.mcstats.bukkit.BukkitUpdateTask.run(BukkitUpdateTask.java:17) ~[MinecraftStats-3.3.0.jar:?]
        at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.4.jar:git-Paper-497]
        at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.20.4.jar:git-Paper-497]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-1.20.4.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.ClassNotFoundException: net.skinsrestorer.api.SkinsRestorerAPI
        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:197) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:164) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
        ... 11 more

Using :

Is there any estimation on when a new build including the fix will be out ? (sorry for the ping @pdinklag )

Thanks :)

Athar42 commented 3 months ago

From my testing so far, the error is still displayed, because the API isn't working when the server is in "Proxy Mode"

Make sure SkinsRestorer is not in "Proxy Mode" if you are using BungeeCord/Velocity.

So, there should be a check to wether enable or not the SkinsRestorer support depending on the functioning mode of it.

Edit : But there might be another solution, on the backend server :

Backend API:
You can enable the backend storage by creating a file called enableSkinStorageAPI.txt in SkinsRestorer folder (backend server -> ./plugins/SkinsRestorer/enableSkinStorageAPI.txt)
This is useful when using plugins like BedWars, Dynmap, etc. that need to get the skin through API from the backend server.
Keep in mind that connecting MySQL to the same database as the proxy is required for this to work!
pdinklag commented 3 months ago

Build 3.3.1 is now released.

From my testing so far, the error is still displayed, because the API isn't working when the server is in "Proxy Mode"

I have genuinely no idea what this means. What is "Proxy Mode"? In any event, if SkinsRestorer doesn't work in "Proxy Mode", then why not not use it in "Proxy Mode"? Why would I fix something in MinecraftStats for SkinsRestorer for a scenario in which SkinsRestorer is not even supposed to work?

Athar42 commented 3 months ago

The "Proxy mode" is used, in general, when you use... a proxy :D (sorry^^, like Velocity).

For example, this is from my Proxy (Velocity server) : image

And on one of my backend server (lobby, creative, or any other, that's the same) : image

And for "SR is not even supposed to work", well, it work in Proxy Mode (it's part of its job), but the API itself, in such mode, it's not : https://skinsrestorer.net/docs/development/api#getting-issues

Make sure SkinsRestorer is not in "Proxy Mode" if you are using BungeeCord/Velocity.

And just in case you wonder "Why" I'm in proxy mode, that's the intended setup for when you use a proxy : https://skinsrestorer.net/docs/installation/velocity

So sadly, SR didn't made it easy for developpers, they have to check in which state this plugin is and, if in "Proxy Mode", disable this (or the users, like me, should enable the "Backend API", but the player skin is not retrieved this way, don't know why. At least, the error just vanish)

pdinklag commented 2 months ago

From my testing so far, the error is still displayed, because the API isn't working when the server is in "Proxy Mode"

To get back to this, are you sure it's exactly the same error? Because the error was that the class was not found, and that's because they renamed it. I updated MinecraftStats to use the new class name, so if there's still an error message, it should really be a different one? Can you post it?

The "Proxy mode" is used, in general, when you use... a proxy :D (sorry^^, like Velocity).

But if a server is a proxy, doesn't it mean it just forwards connections to another server or somehow shares data with another server? I don't really understand why you would set up a statistics framework for a proxy - do you set up MinecraftStats for every proxy?

Could you try aggregating stats from multiple servers instead?

Athar42 commented 2 months ago

I did some "paint skill" :D maybe that'll help in understanding my setup : image

So, the users connect to the proxy and get redirected to the lobby, then they connect to any "GAME" server they want to access. Once they are in a "GAME" server, they aren't connected to the lobby anymore, only through the proxy.

MinecraftStats isn't installed on all of the "GAME" server, just a couple of those. And "SkinRestorer" is, indeed, installed on ALL the servers, proxy included.

So, for SkinRestorer, it's working on my proxy as "a main thread", and all sub-server (Lobby and GAME x) are connected in proxy mode (as you can see in my previous post). In that case, all "sub servers" connect to the proxy to get SkinRestorer datas.

For that specific scenario, you have to enable SR to use an SQL database so that all servers are in sync for the datas.

Anyways, that's not of a big deal, as the only "breaking" stuff I saw is not getting the proper skin of the player (that's sad, but we can live without it 😊)

As you open the change #255 , just get rid of it, that's fine I think.

Your plugin will still rocks without it 😋