[SPIGOT-2820] (What appears to be) a PluginLoader issue Created: 22/Nov/16 Updated: 22/Nov/16 Resolved: 22/Nov/16 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Anonymous Chicken | Assignee: | Unassigned |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | API, Plugin | ||
| Environment: |
OS: Linux (Arch) |
||
| Attachments: |
|
| Plugin: | N/A |
| Description |
|
I'm currently working on a Realms plugin for 1.11, which allows players to create their own worlds. In the onDisable method, it's supposed to close all realm portals, set flight to false for all players not in creative mode, and close the connection to the SQLite database. However, it will occasionally (~25% of the time) throw an error that my class, redempt.realms.Realm, does not exist. I'm not dynamically loading or unloading anything, so it's not my plugin's doing.
My onDisable: @Override public void onDisable() { try { sql.connection.close(); } catch (SQLException e) { e.printStackTrace(); } for (Player player : Bukkit.getOnlinePlayers()) { FlightManager.disableFlight(player); } for (Realm realm : Realm.getRealms()) { realm.closePortal(); } } (Sorry the indentation is messed up) Here's the error: java.lang.NoClassDefFoundError: redempt/realms/FlightManager
at redempt.realms.Main.onDisable(Main.java:95) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:273) ~[spigot-1.11.jar:git-Spigot-16c940b-221508d]
at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:361) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:424) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:417) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at org.bukkit.plugin.SimplePluginManager.clearPlugins(SimplePluginManager.java:458) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at org.bukkit.craftbukkit.v1_11_R1.CraftServer.reload(CraftServer.java:714) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at org.bukkit.Bukkit.reload(Bukkit.java:539) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchCommand(CraftServer.java:647) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchServerCommand(CraftServer.java:633) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at net.minecraft.server.v1_11_R1.DedicatedServer.aM(DedicatedServer.java:437) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:400) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:675) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:574) [spigot-1.11.jar:git-Spigot-16c940b-221508d]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112]
Caused by: java.lang.ClassNotFoundException: redempt.realms.FlightManager
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_112]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot-1.11.jar:git-Spigot-16c940b-221508d]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot-1.11.jar:git-Spigot-16c940b-221508d]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_112]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_112]
... 17 more
As far as I can tell, this means not everything is happening properly. What I think this is is the plugin loader unloading other classes before it unloads my plugin, but I'm not completely sure. This is a pretty serious issue, because it could prevent plugins from properly disabling themselves, which means data might not get saved and plugins not properly shut down. |
| Comments |
| Comment by md_5 [ 22/Nov/16 ] |
|
Replacing the jar before a class is loaded will cause this issue (regardless of if it is modified). |
| Comment by Anonymous Chicken [ 22/Nov/16 ] |
|
No, one issue is from me editing the jar. I haven't had an issue in the past. In fact, I've done it with a 1.7 server without an issue. The issue I reported, however, happens even when the jar is not modified and the server is reloaded or shutdown. |
| Comment by md_5 [ 22/Nov/16 ] |
|
And by sample plugin I mean the minimal amount of code to reproduce the issue. |
| Comment by md_5 [ 22/Nov/16 ] |
|
You can't edit the jar whilst the server is running - java doesn't support that. |
| Comment by Anonymous Chicken [ 22/Nov/16 ] |
|
Attached, I've found that when I edit the jar while the server is up and reload, the server crashes, and even when the jar is not changed it has a chance to throw that exception. |
| Comment by md_5 [ 22/Nov/16 ] |
|
Please attach a sample plugin which reproduces the issue. |