What's org.bukkit.plugin.InvalidPluginException?

Discussion in 'Plugin Development' started by Nineza, Jan 17, 2011.

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

    Nineza

    Okay, I have started to attempt to make a plugin. I thought it'd be quite fun coding some plugins for my own server, and maybe release them, rather than just taking the ones released without any idea how to make them.

    I went onto the Programming a Plugin bit of the Wiki, followed everything it said there, added a little test thingy in, where when someone says 'test', it changes their text to be 'Testing 123 NinTools Plugin! =D', just as a little test to see if my plugin works.
    When I ran my server, at first I came across an error, something to do with being unable to unzip the jar or something. I found out that I needed to get a newer version of bukkit and craftbukkit, and that appears to have solved it.

    Now I've got another error. Saying something about org.bukkit.plugin.InvalidPluginException. I looked around the error, trying to find a clue as to which bit of code was causing the error, but couldn't work it out.

    Here's the error:
    Code:
    2011-01-17 17:25:43 [INFO] Starting minecraft server version Beta 1.2_01
    2011-01-17 17:25:43 [INFO] Loading properties
    2011-01-17 17:25:43 [INFO] Starting Minecraft server on *:25565
    2011-01-17 17:25:43 [INFO] Preparing level "NineCraft"
    2011-01-17 17:25:43 [INFO] Preparing start region
    Preparing spawn area: 8%
    Preparing spawn area: 28%
    Preparing spawn area: 81%
    2011-01-17 17:25:47 [INFO] [iConomy] version [2.0] (Selmina) loaded
    17-Jan-2011 17:25:47 org.bukkit.plugin.SimplePluginManager loadPlugins
    SEVERE: Could not load plugins\NinTools.jar in plugins: null
    org.bukkit.plugin.InvalidPluginException
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:83)
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    java:115)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:80)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:41)
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:153)
            at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:140)
            at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:104)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:177)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    Caused by: java.lang.ClassNotFoundException: NinTools.NinTools
            at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:29)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:247)
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:77)
            ... 8 more
    2011-01-17 17:25:47 [INFO] Done! For help, type "help" or "?"
    So, I was wondering, can any of you tell me which file it is that has the error in, and which part?
    I'll post some code if you want, but I've got a few files of code, which could be a problem for the forums.
    Or I could just upload it... If you want.

    So yeah, I hope someone can help.
    And thanks in advance. =D
     
  2. Offline

    QuantumAI

    It would be helpful if you could post your main plugin file, NinTools.java i guess, and your plugin.yml file.
     
  3. Offline

    Reil

    Code:
    Caused by: java.lang.ClassNotFoundException: NinTools.NinTools
    This would suggest that the package listed in your plugin.yml is either incorrect (pointing to the wrong package/class), or that there is a class that wasn't exported to the .jar like it should have been.
     
  4. Offline

    Nineza

    Yeah. I noticed that just now while looking at my plugin.yml file to post.
    It used to be:
    Code:
    name: NinTools
    main: NinTools.NinTools
    version: 0.0.0.1
    Then I changed it to
    Code:
    name: NinTools
    main: NinTools
    version: 0.0.0.1
    And then it errors with the same error, except it changed NinTools.NinTools to NinTools in the java.lang.ClassNotFoundException bit.

    Now. My class file is in com.bukkit.Nineza.NinTools.NinTools. I'm guessing I should change it to that.

    Just tried that. Still fails. >.>

    He's an outline of my folder hierarchy.

    Code:
    NinTools
    -bin
    --com
    ---bukkit
    ----Nineza
    -----NinTools
    ------NinTools.class
    ------NTBlockListener.class
    ------NTChatListener.class
    ------NTCommandListener.class
    ------NTPlayerListener.class
    --plugin.yml
    -src
    --com
    ---bukkit
    ----Nineza
    -----NinTools
    ------NinTools.java
    ------NTBlockListener.java
    ------NTChatListener.java
    ------NTCommandListener.java
    ------NTPlayerListener.java
    --plugin.yml
    -.classpath
    -.project
    -compile.bat
    -NinTools.jar (Same as file in my plugins directory of my bukkit server.)
    So... Umm. What could be wrong? D=
     
  5. Offline

    QuantumAI

    Code:
    name: NinTools
    main: NinTools
    version: 0.0.0.1
    it should be
    Code:
    name: NinTools
    main: com.bukkit.Nineza.NinTools.NinTools
    version: 0.0.0.1
    with "yourname" being whatever name you used when you set up the package. assuming you followed the tutorial and set up your plugin correctly.

    edit: fixed when i saw your directory listing
     
  6. Offline

    Nineza

    Oh, lol. I used /'s instead of .'s when I just tried it. That's why it failed.

    Yey! It's works.
    Thanks for fixing my very stupid mistake. =P
     
  7. Offline

    QuantumAI

    No problem but next time try using the search function before making a thread, this is a fairly common problem.
     
  8. Offline

    Nineza

    Oh. Right.
    Sorry, didn't realise it was common.
    I'll be sure to use the search function more. I'm usually very good with it... =P
    Oh well.
    Thanks again.
     
  9. Offline

    toughpeace1

    HELP!!! there isn't a plugin.yml file!
     
  10. Offline

    QuantumAI

    This thread is over a year old. If there isn't a plugin.yml file that's because you didn't make one. There are plenty of basic tutorials in Plugin Development > Resources.
     
Thread Status:
Not open for further replies.

Share This Page