What does this error mean?

Discussion in 'Plugin Development' started by epicfacecreeper, Mar 30, 2012.

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

    epicfacecreeper

    I am getting an odd error when I try to load a plugin I'm making.
    Code:
    09:47:13 [SEVERE] Could not load 'plugins\AdminCrate.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Fi
    le cannot be null
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:148)
            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:207)
            at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:183)
            at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigur
    ationManager.java:53)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:156)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:425)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:490)
    Caused by: java.lang.IllegalArgumentException: File cannot be null
            at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(Yam
    lConfiguration.java:171)
            at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:117)
            at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:111)
            at net.cyberninjapiggy.AdminCrate.AdminCrate.<init>(AdminCrate.java:36)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
     
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
    rce)
            at java.lang.reflect.Constructor.newInstance(Unknown Source)
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:144)
            ... 8 more
    I was wondering what this error is caused by, and how would I fix it? Thanks.
     
  2. Offline

    Mr Washington

    Error here: net.cyberninjapiggy.AdminCrate.AdminCrate.<init>(AdminCrate.java:36)

    Fix: Check if config is null, if so, create the file
     
  3. Offline

    epicfacecreeper

    Config is there. line 36 is a variable declaration.

    It seems that I did something wrong by not reading the config tutorial entirely.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 24, 2016
  4. Offline

    Mr Washington

    epicfacecreeper re-read it and try again, I too have problems with configurations. Don't worry!
     
  5. Offline

    epicfacecreeper

    Okay. Here is my file tree:
    tree.PNG
    Here is my plugins folder:
    plugins.PNG
    Here is my AdminCrate folder:
    admincrate.PNG
    Here is my config.yml:
    Code:
    rage:
      players:
      - legocreeper3
      - sometroll
      interval: 3 
    jail:
      jailmsg: You have been jailed!
      unjailmsg: You have been unjailed!
      players:
      - someannoyingguy
      - anotherannoyingguy
      jailpoint:
        x: 0
        y: 64
        z: 0
        world: world
      unjailpoint:
        x: 0
        y: 64
        z: 0
        world: world
    rules:
      - No griefing
      - No swearing
      - Have fun
    motd: Welcome to the server!
    PLEASE PLEASE PLEASE tell me what I'm doing wrong.
     
  6. Offline

    ferrybig

    your calling "getConfig()" from constructor
     
  7. Offline

    epicfacecreeper

    I'm not sure what you mean. Once I do understand, how would I fix it?
     
  8. Offline

    ferrybig

    this error is caused by callig the methode "getConfig()" from JavaPlugin, before onLoad() (or onEnable() for the guys that dont use onLoad()) is called from the same JavaPlugin.
     
  9. Offline

    kumpelblase2

    I don't think from the constructor, but before the constructor.

    epicfacecreeper: can you post your AdminCrate class?
     
  10. Offline

    ferrybig

    at net.cyberninjapiggy.AdminCrate.AdminCrate.<init>(AdminCrate.java:36)
    <init> = constructor
     
  11. Offline

    kumpelblase2

    party true.
    if you do this code:
    Code:
    public class WhatEver
    {
        private int variable = this.doWhateverFunction();
        private int test;
     
        public WhatEver() //It is basically unnecessary here but for the sake of the example it put it in
        {
        }
     
        public int doWhateverFunction()
        {
            return this.test;
        }
    }
    it will still give about the same stack trace even though it is not directly in the constructor.
     
  12. Offline

    ferrybig

    its constructed while the object is construking, its not directly inside it, but its more virtual inside
     
  13. Offline

    epicfacecreeper

    thanks! I'll try that.
     
Thread Status:
Not open for further replies.

Share This Page