File Cannot be Null

Discussion in 'Plugin Development' started by tangochicken, Sep 9, 2013.

Thread Status:
Not open for further replies.
  1. I can't seem to find anything that could be causing this:

    Show Spoiler

    org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Fi
    le cannot be null
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:182)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    java:305)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:230)
    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugins(CraftServer.ja
    va:239)
    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.reload(CraftServer.java:60
    3)
    at org.bukkit.Bukkit.reload(Bukkit.java:275)
    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:
    23)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
    9)
    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchCommand(CraftServe
    r.java:523)
    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchServerCommand(Craf
    tServer.java:512)
    at net.minecraft.server.v1_6_R2.DedicatedServer.ar(DedicatedServer.java:
    262)
    at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:2
    27)
    at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:4
    86)
    at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java
    :419)
    at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:5
    82)
    Caused by: java.lang.IllegalArgumentException: File cannot be null
    at org.apache.commons.lang.Validate.notNull(Validate.java:203)
    at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(Yam
    lConfiguration.java:170)
    at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:117)
    at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:111)
    at me.tangochicken.tipsy.Main.<init>(Main.java:72)
    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:178)
    ... 14 more


    Line 72 is:
    String Name = this.getConfig().getString("Name");

    Thanks for any help!
     
  2. Offline

    The_Doctor_123

    Does the file exist?
     
  3. The config.yml does, yes. I checked the exported jar with winrar for it. All okay there...
     
  4. Offline

    1Rogue


    Exported jar? What is the path of your config file under your plugins folder?
     
  5. Offline

    The_Doctor_123

    I meant in the plugins folder.
     
  6. Ah, that was me being a bit dumb there, the folder for the plugin hasn't event generated. I'll have another look at the code. If anything, this thread has let me realise what could be the problem, which is what this forum is here for. Thanks! :D
     
  7. dont call the getconfig before the onenable is called
     
  8. I just went over my code and cannot work out why it is not generating. The folder for and the config.yml itself are not generating on plugin load. My onEnable is

    Code:java
    1. getServer().getPluginManager().registerEvents(this, this);
    2. getConfig().options().copyDefaults(getConfig().contains("Name:"));
    3. saveConfig();
     
Thread Status:
Not open for further replies.

Share This Page