Error cannot load plugin.. Help

Discussion in 'Plugin Development' started by HeyAwesomePeople, Sep 5, 2012.

Thread Status:
Not open for further replies.
  1. I am starting up this plugin and it will not load. This is the error on the consel:

    2012-09-05 18:18:28 [SEVERE] Could not load 'plugins\AutoSaveWorld.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: me.heyawesomepeople.autosave
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:155)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:222)
    at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:198)
    at net.minecraft.server.ServerConfigurationManagerAbstract.<init>(ServerConfigurationManagerAbstract.java:50)
    at net.minecraft.server.ServerConfigurationManager.<init>(SourceFile:11)
    at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:105)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:378)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    Caused by: java.lang.ClassNotFoundException: me.heyawesomepeople.autosave
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:44)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:29)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:144)
    ... 9 more
    Is it something in the plugin.yml? There are only 2 warnings and they are "Not Used" warnings. Thanks
    -HeyAwesomePeople
     
  2. Offline

    _Waffles_

    I think your class specified in your plugin.yml doesn't match your actual main class.
     
  3. Offline

    Courier

    I'm guessing you plugin.yml says something like this:
    Code:
    main: me.heyawesomepeople.autosave
    ...and you want it to say something more like this:
    Code:
    main: me.heyawesomepeople.autosave.MainPlugin
    Eclipse (or any other IDE) won't give you errors or warnings for your plugin.yml, because it is just a text file as far as it is concerned.

    Well, there might be an IDE (or an Eclipse plugin) that recognizes the yml format and can show you syntax errors, but it wouldn't have caught this.
     
  4. _Waffles_

    I am getting a similair issue.

    Heres my yml now:


    Code:
    name: MeedlesManiacMessage
    main: me.dudemanmax.meedlesmaniacmessages.Main
    version: 0.1
    author: dudemanmax
    description: Simple Join Message Plugin.
    
    My code:


    Code:
    package me.dudemanmaxmeedlesmaniacmessages;
     
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin{
    public static Main plugin;
     
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event){
    Player player = event.getPlayer();
    event.setJoinMessage(ChatColor.GOLD + "Hello " + player.getName() + ". Welcome To: " + player.getWorld().getName() + ". The time is " + player.getWorld().getTime());
     
     
     
    }
    }

    and my error:

    Code:
    C:\Users\yummy_000\Desktop\TestServer>java -Xms1024M -Xmx1024M -jar craftbukkit.
    jar -o true
    210 recipes
    27 achievements
    20:29:17 [INFO] Starting minecraft server version 1.4.7
    20:29:17 [INFO] Loading properties
    20:29:17 [INFO] Default game type: SURVIVAL
    20:29:17 [INFO] Generating keypair
    20:29:17 [INFO] Starting Minecraft server on *:25565
    20:29:17 [INFO] This server is running CraftBukkit version git-Bukkit-1.4.7-R0.1
    -16-g226204e-b2616jnks (MC: 1.4.7) (Implementing API version 1.4.7-R0.2-SNAPSHOT
    )
    20:29:17 [SEVERE] Could not load 'plugins\MeedlesManiacMessags.jar' in folder 'p
    lugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: me.d
    udemanmax.meedlesmaniacmessages.Main
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:184)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    java:305)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:230)
    at org.bukkit.craftbukkit.v1_4_R1.CraftServer.loadPlugins(CraftServer.ja
    va:239)
    at org.bukkit.craftbukkit.v1_4_R1.CraftServer.<init>(CraftServer.java:21
    7)
    at net.minecraft.server.v1_4_R1.PlayerList.<init>(PlayerList.java:55)
    at net.minecraft.server.v1_4_R1.DedicatedPlayerList.<init>(SourceFile:11
    )
    at net.minecraft.server.v1_4_R1.DedicatedServer.init(DedicatedServer.jav
    a:104)
    at net.minecraft.server.v1_4_R1.MinecraftServer.run(MinecraftServer.java
     
  5. Offline

    _Waffles_

    In the plugin.yml its me.dudemanmax.meedlesmaniacmessages.Main but in the code its me.dudemanmaxmeedlesmaniacmessages.Main, you are missing a dot in the code or have an extra dot.
     
  6. _Waffles_

    Lol yea have I learned my lesson.

    I changed it to that but it still shows up as an error.

    Heres what I have.

    Code:
    name: MeedlesManiacMessage
    main: me.dudemanmaxmeedlesmaniacmessages.Main
    description: Simple Join Message Plugin.
    version: 0.1
    author: dudemanmax
     
     
      
    And my code:

    Code:
    package me.dudemanmaxmeedlesmaniacmessages.Main;
     
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin{
        public static Main plugin;
       
        @EventHandler
        public void onPlayerJoin(PlayerJoinEvent event){
            Player player = event.getPlayer();
            event.setJoinMessage(ChatColor.GOLD + "Hello " + player.getName() + ". Welcome To: " + player.getWorld().getName() + ". The time is " + player.getWorld().getTime());
           
           
           
           
        }
    }
    
     
  7. Offline

    _Waffles_

    Is the error exactly the same? or is it a different error?
    If its the same check that the class file exported correctly.
     
  8. I got it to load, I had .Main in my code which I was not supposed to have. But now my plugin is not operating properly. It is not displaying the message like I need it to. Hers my code:

    Code:
    package me.dudemanmaxmeedlesmaniacmessages;
     
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin{
        public static Main plugin;
       
        @EventHandler
        public void onPlayerJoin(PlayerJoinEvent event){
            Player player = event.getPlayer();
            event.setJoinMessage(ChatColor.GOLD + "Hello " + player.getName() + ". Welcome To: " + player.getWorld().getName() + ". The time is " + player.getWorld().getTime());
           
           
           
           
        }
    }
    
     
  9. Offline

    _Waffles_

    you need to change it to this
    Code:
    public class Main extends JavaPlugin implements Listener{//TODO this is so the event handler can use the class properly
        public static Main plugin;
     
        public void onEnable()
        {
            getServer().getPluginManager().registerEvents(this, this)//You need to register the listener before the messages will get called
        }
     
        @EventHandler
        public void onPlayerJoin(PlayerJoinEvent event){
            Player player = event.getPlayer();
            event.setJoinMessage(ChatColor.GOLD + "Hello " + player.getName() + ". Welcome To: " +             player.getWorld().getName() + ". The time is " + player.getWorld().getTime());
         
         
         
         
        }
    }
     
  10. it comes up with an error. For both of my plugins.
     
Thread Status:
Not open for further replies.

Share This Page