Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-2820

(What appears to be) a PluginLoader issue

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Major Major
    • None
    • None
    • OS: Linux (Arch)
      Java 8

    • N/A

      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.

            Unassigned Unassigned
            Redempt Anonymous Chicken
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: