Solved ERROR InvalidPluginException

Discussion in 'Plugin Development' started by Matroxko, Jul 23, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    Matroxko

    I got this error when enabling the server...
    Code:
    [20:16:13 ERROR]: Could not load 'plugins\BasicPlusPlus.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Plugin already initialized!
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:325) ~[craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:248) [craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:298) [craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.<init>(CraftServer.java:260) [craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at net.minecraft.server.v1_12_R1.PlayerList.<init>(PlayerList.java:74) [craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at net.minecraft.server.v1_12_R1.DedicatedPlayerList.<init>(SourceFile:14) [craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:186) [craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:521) [craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
    Caused by: java.lang.IllegalArgumentException: Plugin already initialized!
            at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:98) ~[craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:60) ~[craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at matroxko.plugin.sk.Main.<init>(Main.java:11) ~[?:?]
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_131]
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_131]
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_131]
            at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_131]
            at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_131]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            ... 9 more
    Caused by: java.lang.IllegalStateException: Initial initialization
            at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:101) ~[craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:60) ~[craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at matroxko.plugin.sk.Main.<init>(Main.java:11) ~[?:?]
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_131]
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_131]
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_131]
            at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_131]
            at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_131]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[craftbukkit-1.12.jar:git-Bukkit-c1b8cac]
            ... 9 more
    
    (Main.java:11) is this :
    import org.bukkit.plugin.java.JavaPlugin;

    And i don't know what it means or what should i do ...
    Can some1 help ?
    Thx. :)
     
  2. Offline

    flash1110

    The two cases for this exception are:

    A. There are more than one class in your .jar file, which extends the JavaPlugin class.

    B. You have two plugins which have the same package link to their main classes.
     
    mehboss likes this.
  3. Offline

    mehboss

    Make sure you only have one class that extends JavaPlugin, this being your main class or the one with the onEnable in it.
     
  4. Offline

    Matroxko

    I have 2 plugins with Main extending JavaPlugin Class...
    Is it necessary tthat every Main class extends JavaPlugin ?
    @mehboss @flash1110
     
  5. Offline

    Machine Maker

    @Matroxko
    Every separate plugin should have one and only one class that extends JavaPlugin. So yes if you look at all your plugins as a whole, you will have more that one class that extends JavaPlugin, but there should only be one per plugin.
     
  6. Offline

    RcExtract

    Main is the name of a class, regardless to inheriting JavaPlugin.

    Sent from my LG-H860 using Tapatalk
     
  7. Offline

    timtower Moderator Moderator

    @Matroxko You probably have 2 plugins with the same package and same main class.
    This will conflict.
    Please post both plugin.yml files.
     
Thread Status:
Not open for further replies.

Share This Page