Solved ClassNotFoundException when extending core plugin

Discussion in 'BungeeCord Plugin Development' started by Nuubles, Jul 21, 2019.

  1. I've made a small core plugin to work behind the scenes to allow message translation and allow similar config management as in spigot for extending plugins. However, when I'm trying to test if the plugin works by extending it, the plugin extending (Foxet) throws ClassNotFoundException as it cannot find the class net.karanteeni.bungee.KaranteeniBungee. Both plugins are in the plugins folder and both have been built freshly.

    Here's the mandatory part for the extending plugin:
    Code (Java):
    public class Foxet extends KaranteeniBungee {
        public Foxet() {
            super("Foxet");
        }
    }
    call to super is with identical name compared to the name in plugin.yml.

    Dependency has been set to plugin.yml
    Code (YAML):
    depend: [KaranteeniBungee]
    18:15:17 [WARNING] Error enabling plugin FoxetBungee
    java.lang.NoClassDefFoundError: net/karanteeni/bungee/KaranteeniBungee
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at net.md_5.bungee.api.plugin.PluginClassloader.loadClass0(PluginClassloader.java:34)
    at net.md_5.bungee.api.plugin.PluginClassloader.loadClass(PluginClassloader.java:27)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at net.md_5.bungee.api.plugin.PluginManager.enablePlugin(PluginManager.java:324)
    at net.md_5.bungee.api.plugin.PluginManager.loadPlugins(PluginManager.java:232)
    at net.md_5.bungee.BungeeCord.start(BungeeCord.java:265)
    at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:62)
    at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
    Caused by: java.lang.ClassNotFoundException: net.karanteeni.bungee.KaranteeniBungee
    at net.md_5.bungee.api.plugin.PluginClassloader.loadClass0(PluginClassloader.java:53)
    at net.md_5.bungee.api.plugin.PluginClassloader.loadClass(PluginClassloader.java:27)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 18 more
    18:15:17 [INFO] Loaded plugin cmd_server version git:cmd_server:1.14-SNAPSHOT:5c6bc18:1418 by SpigotMC
    18:15:17 [INFO] Plugin registered to KaranteeniBungee: KaranteeniBungee
    18:15:17 [INFO] Loaded plugin KaranteeniBungee version 1.0 by Nuubles
     
  2. KaranteeniBungee is loading afer FoxetBungee. check if you are propertly writing plugin.yml for both plugins
     
    • Informative Informative x 1
  3. Oh, it should've been "depends" instead of "depend". Thanks for the info!