Solved Plugin already Initialized Issue

Discussion in 'Plugin Development' started by alexjvan, Aug 11, 2016.

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

    alexjvan

    I get this issue on start up where the plugin says it was already initialized. I tried reloading and that didn't work. It's the only plugin in the server; so that's not the issue. I've done a bit of research but just can't find anything that works.

    Code:
    
    [00:18:44] [Server thread/INFO]: Starting minecraft server version 1.10.2
    [00:18:44] [Server thread/INFO]: Loading properties
    [00:18:44] [Server thread/INFO]: Default game type: SURVIVAL
    [00:18:44] [Server thread/INFO]: Generating keypair
    [00:18:44] [Server thread/INFO]: Starting Minecraft server on *:25565
    [00:18:45] [Server thread/INFO]: Using default channel type
    [00:18:46] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-0ebb9c7 (MC: 1.10.2) (Implementing API version 1.10.2-R0.1-SNAPSHOT)
    [00:18:46] [Server thread/INFO]: [GA-API] Loading GA-API v0.1.0
    [00:18:46] [Server thread/INFO]: Preparing level "world"
    [00:18:47] [Server thread/INFO]: Preparing start region for level 0 (Seed: -6952378622870375874)
    [00:18:48] [Server thread/INFO]: Preparing spawn area: 0%
    [00:18:49] [Server thread/INFO]: Preparing spawn area: 9%
    [00:18:50] [Server thread/INFO]: Preparing spawn area: 39%
    [00:18:52] [Server thread/INFO]: Preparing spawn area: 56%
    [00:18:53] [Server thread/INFO]: Preparing spawn area: 80%
    [00:18:53] [Server thread/INFO]: Preparing start region for level 1 (Seed: -6952378622870375874)
    [00:18:54] [Server thread/INFO]: Preparing spawn area: 22%
    [00:18:55] [Server thread/INFO]: Preparing spawn area: 88%
    [00:18:55] [Server thread/INFO]: Preparing start region for level 2 (Seed: -6952378622870375874)
    [00:18:56] [Server thread/INFO]: [GA-API] Enabling GA-API v0.1.0
    [00:18:56] [Server thread/ERROR]: Error occurred while enabling GA-API v0.1.0 (Is it up to date?)
    java.lang.IllegalArgumentException: Plugin already initialized!
        at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:98) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:67) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at com.gmail.alexjvan.ga.api.acessentials.commands.CommandBan.<init>(CommandBan.java:10) ~[?:?]
        at com.gmail.alexjvan.ga.api.Core.onEnable(Core.java:118) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:292) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [craftbukkit.jar:git-Bukkit-0ebb9c7]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [craftbukkit.jar:git-Bukkit-0ebb9c7]
        at org.bukkit.craftbukkit.v1_10_R1.CraftServer.loadPlugin(CraftServer.java:347) [craftbukkit.jar:git-Bukkit-0ebb9c7]
        at org.bukkit.craftbukkit.v1_10_R1.CraftServer.enablePlugins(CraftServer.java:319) [craftbukkit.jar:git-Bukkit-0ebb9c7]
        at net.minecraft.server.v1_10_R1.MinecraftServer.t(MinecraftServer.java:407) [craftbukkit.jar:git-Bukkit-0ebb9c7]
        at net.minecraft.server.v1_10_R1.MinecraftServer.l(MinecraftServer.java:372) [craftbukkit.jar:git-Bukkit-0ebb9c7]
        at net.minecraft.server.v1_10_R1.MinecraftServer.a(MinecraftServer.java:327) [craftbukkit.jar:git-Bukkit-0ebb9c7]
        at net.minecraft.server.v1_10_R1.DedicatedServer.init(DedicatedServer.java:242) [craftbukkit.jar:git-Bukkit-0ebb9c7]
        at net.minecraft.server.v1_10_R1.MinecraftServer.run(MinecraftServer.java:517) [craftbukkit.jar:git-Bukkit-0ebb9c7]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
    Caused by: java.lang.IllegalStateException: Initial initialization
        at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:101) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:67) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at com.gmail.alexjvan.ga.api.Core.<init>(Core.java:67) ~[?:?]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_45]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_45]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_45]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[?:1.8.0_45]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_45]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at org.bukkit.craftbukkit.v1_10_R1.CraftServer.loadPlugins(CraftServer.java:294) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at org.bukkit.craftbukkit.v1_10_R1.CraftServer.<init>(CraftServer.java:256) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at net.minecraft.server.v1_10_R1.PlayerList.<init>(PlayerList.java:70) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at net.minecraft.server.v1_10_R1.DedicatedPlayerList.<init>(SourceFile:14) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        at net.minecraft.server.v1_10_R1.DedicatedServer.init(DedicatedServer.java:183) ~[craftbukkit.jar:git-Bukkit-0ebb9c7]
        ... 2 more
    [00:18:56] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [00:18:56] [Server thread/INFO]: Done (9.882s)! For help, type "help" or "?"
    [00:18:59] [Server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 3205ms behind, skipping 64 tick(s)
    
    
     
  2. Online

    timtower Administrator Administrator Moderator

  3. Offline

    Ben_Mattis

    Is it possible that your class has the Class of your Plugin has the same names?
    If the way to the main-Class is the same, the plugin can't be loadet.
    (plugin.yml > main: way.to.themain)
     
  4. Offline

    N00BHUN73R

    @alexjvan
    This could be due to you making a new instance of your main class somewhere in your plugin, such as new Main() where instead you're supposed to pass it in a constructor.
    Although this might be the issue, it would be helpful if you could post your code :p
     
  5. Offline

    alexjvan

  6. Offline

    Zombie_Striker

    @alexjvan
    Are you sure you don't have another plugin with the same package name? Are you sure you never initialized the main class twice? Are you sure there is only one copy of this plugin in you server/plugins folder?

    For some reason, it is seeming two classes that both extend Java plugin and have the same path. What I would recommend is having a server with no other plugins on it, comment out all the lines in the onEnable, and un-comment them until you receive an error. Once you do, you know that something regarding that line is creating a new main class instance.
     
  7. Online

    timtower Administrator Administrator Moderator

    @alexjvan You can't have multiple classes extending JavaPlugin.
     
  8. Offline

    alexjvan

    @Zombie_Striker I tried that and it loaded fine the first time, but at the first command I tried to add on; it gave me the error again.

    @timtower How do you get the config file for separate classes then?
     
  9. Offline

    Zombie_Striker

    @alexjvan
    Then that means the first command is trying to recreate a main class. Can you post that class?

    [Edit] Just making sure, there is only one class in your entire plugin that extends JavaPlugin? This issue has happened before.
     
  10. Online

    timtower Administrator Administrator Moderator

    @alexjvan That is where you use constructors and pass the main instance around.
     
  11. Offline

    ArsenArsen

  12. Either, Multiple classes are extending JavaPlugin, Or, You have 2 of the same plugins in your /Plugins directory. Like @ArsenArsen said, When using multiple classes with commands, implements CommandExecutor is always good.
     
  13. Offline

    ArsenArsen

    @Mindlessmink if he had two of the same plugin bukkit would load the one it found first, and say ambiguous plugin names for file1 and file2
     
  14. Offline

    alexjvan

    @timtower Ok, thank you. That seemed to work
     
  15. Okay @alexjvan. Please mark the thread as solved ;)
     
Thread Status:
Not open for further replies.

Share This Page