Solved Abnormal Plugin Type?

Discussion in 'Plugin Development' started by bdubz4552, Jun 14, 2014.

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

    bdubz4552

    I added a few statements to instantiate some classes, and now this is happening:
    Code:
    org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:56) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:357) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.reload(CraftServer.java:799) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at org.bukkit.Bukkit.reload(Bukkit.java:288) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:180) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchCommand(CraftServer.java:703) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchServerCommand(CraftServer.java:690) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at net.minecraft.server.v1_7_R3.DedicatedServer.aB(DedicatedServer.java:296) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:261) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:558) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:469) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
    Caused by: java.lang.InstantiationException: bdubz4552.bukkit.plugins.fernmode.FernModeMain
            at java.lang.Class.newInstance(Unknown Source) ~[?:1.7.0_25]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-63-g8356f65-b3075jnks]
            ... 15 more
    As you can see, it does not give me a line number, as it usually does, but I do know it has something to do with:
    Code:java
    1. finder = new Finder(this);
    2. action = new FernModeAction(this, finder);

    These. They're inside my onEnable(). "finder" and "action" are already defined earlier in the class as empty class references, and "this" is a reference to the main class that these are located in (main class being the plugin's main class).

    It seems like a Bukkit/plugin issue in that I can't instantiate anything in my main class, but I can in others. Anything I can do? Or do I have to *shivers* suck it up and rewrite these two classes methods as static?
     
  2. Offline

    xTigerRebornx

    bdubz4552 Can you post the full class, it helps us determine the problem. Also, if you feel needed, post the 2 classes you show in your code snippet
     
  3. Offline

    garbagemule

    Okay, there is no (feasible) way for Bukkit to prevent you from creating instances of arbitrary objects, so go ahead and drop that silly idea ;)

    You are given relevant line numbers in the stacktrace, but you are looking in the wrong place. At the very top of your stacktrace, you see the exception is thrown from line 56 in PluginClassLoader. Furthermore, you see that the exception caught in line 55 is an InstantiationException. These exceptions often occur when trying to create objects of a class without a zero-argument (or nullary) constructor via reflection, which is exactly what Bukkit attempts to do for all plugins (how would Bukkit know what arguments to pass to an arbitrary n-ary constructor?). In other words, you either erroneously created an invalid (n-ary with n > 0) constructor, or you've overridden the implicit nullary constructor and given it a too restrictive access modifier (i.e. non-public).
     
  4. Offline

    bdubz4552

    xTigerRebornx Please give me a darwin award at your earliest convenience. I deleted the constructor and its working.
     
Thread Status:
Not open for further replies.

Share This Page