Time Session Lock Error

Discussion in 'Plugin Development' started by Dreeass, May 17, 2012.

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

    Dreeass

    So in my previous topic I was trying to copy the new world, the thing that was wrong was the path. So I got it all fixed and when loading a world I use the WorldCreator:

    Code:java
    1. new CopyWorld(plugin).main(player);
    2. plugin.MessageConvert(player, "Messages.Start/Stop.Starting");
    3.  
    4. File destFolder = new File( new File(plugin.getConfig().getString("Config.CopyToWorld")).getAbsolutePath());
    5.  
    6. if(destFolder.exists()) {
    7. plugin.getServer().createWorld(new WorldCreator(plugin.getConfig().getString("Config.CopyToWorld")).environment(Environment.NORMAL));
    8. }


    But when loading the world with the WorldCreator, it gives a big error with the Session.lock file. This doesn't happen when I don't use the WorldCreator and only copy the files, ofcourse the copying goes perfectly.

    Error:
    Code:java
    1. 15:33:16 [INFO] File copied from D:\Scripting\Bukkit\Testserver\world_tsgdefault
    2. \session.lock to D:\Scripting\Bukkit\Testserver\world_tsg\session.lock
    3. 15:33:16 [INFO] Done
    4. 15:33:16 [SEVERE] java.io.FileNotFoundException: .\D:\Scripting\Bukkit\Testserve
    5. r\world_tsg\session.lock (De syntaxis van de bestandsnaam, mapnaam of volumenaam
    6. is onjuist)
    7. 15:33:16 [SEVERE] at java.io.FileOutputStream.open(Native Method)
    8. 15:33:16 [SEVERE] at java.io.FileOutputStream.<init>(Unknown Source)
    9. 15:33:16 [SEVERE] at java.io.FileOutputStream.<init>(Unknown Source)
    10. 15:33:16 [SEVERE] at net.minecraft.server.WorldNBTStorage.f(WorldNBTStorag
    11. e.java:44)
    12. 15:33:16 [SEVERE] at net.minecraft.server.WorldNBTStorage.<init>(WorldNBTS
    13. torage.java:38)
    14. 15:33:16 [SEVERE] at net.minecraft.server.ServerNBTManager.<init>(SourceFi
    15. le:17)
    16. 15:33:16 [SEVERE] at org.bukkit.craftbukkit.CraftServer.createWorld(CraftS
    17. erver.java:657)
    18. 15:33:16 [SEVERE] at me.Dreeass.TheSurvivalGames.Game_Start.Start(Game_Sta
    19. rt.java:29)
    20. 15:33:16 [SEVERE] at me.Dreeass.TheSurvivalGames.Command_Tsg.onCommand(Com
    21. mand_Tsg.java:78)
    22. 15:33:16 [SEVERE] at org.bukkit.command.PluginCommand.execute(PluginComman
    23. d.java:40)
    24. 15:33:16 [SEVERE] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCo
    25. mmandMap.java:166)
    26. 15:33:16 [SEVERE] at org.bukkit.craftbukkit.CraftServer.dispatchCommand(Cr
    27. aftServer.java:473)
    28. 15:33:16 [SEVERE] at net.minecraft.server.NetServerHandler.handleCommand(N
    29. etServerHandler.java:821)
    30. 15:33:16 [SEVERE] at net.minecraft.server.NetServerHandler.chat(NetServerH
    31. andler.java:781)
    32. 15:33:16 [SEVERE] at net.minecraft.server.NetServerHandler.a(NetServerHand
    33. ler.java:764)
    34. 15:33:16 [SEVERE] at net.minecraft.server.Packet3Chat.handle(Packet3Chat.j
    35. ava:34)
    36. 15:33:16 [SEVERE] at net.minecraft.server.NetworkManager.b(NetworkManager.
    37. java:229)
    38. 15:33:16 [SEVERE] at net.minecraft.server.NetServerHandler.a(NetServerHand
    39. ler.java:113)
    40. 15:33:16 [SEVERE] at net.minecraft.server.NetworkListenThread.a(NetworkLis
    41. tenThread.java:78)
    42. 15:33:16 [SEVERE] at net.minecraft.server.MinecraftServer.w(MinecraftServe
    43. r.java:551)
    44. 15:33:16 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftSer
    45. ver.java:449)
    46. 15:33:16 [SEVERE] at net.minecraft.server.ThreadServerApplication.run(Sour
    47. ceFile:492)
    48. 15:33:16 [SEVERE] null
    49. org.bukkit.command.CommandException: Unhandled exception executing command 'tsg'
    50. in plugin TheSurvivalGames v0.1
    51. at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
    52. at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:16
    53. 6)
    54. at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:4
    55. 73)
    56. at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.
    57. java:821)
    58. at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:781)
    59.  
    60. at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:764)
    61. at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:34)
    62. at net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
    63. at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:113)
    64. at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:7
    65. 8)
    66. at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:551)
    67. at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:449)
    68. at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    69. Caused by: java.lang.RuntimeException: Failed to check session lock, aborting
    70. at net.minecraft.server.WorldNBTStorage.f(WorldNBTStorage.java:53)
    71. at net.minecraft.server.WorldNBTStorage.<init>(WorldNBTStorage.java:38)
    72. at net.minecraft.server.ServerNBTManager.<init>(SourceFile:17)
    73. at org.bukkit.craftbukkit.CraftServer.createWorld(CraftServer.java:657)
    74. at me.Dreeass.TheSurvivalGames.Game_Start.Start(Game_Start.java:29)
    75. at me.Dreeass.TheSurvivalGames.Command_Tsg.onCommand(Command_Tsg.java:78
    76. )
    77. at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
    78. ... 12 more
    79. >


    I know the error: FileNotFound, but the file is there!

    Someone please? I tried out some stuff, but it doesn't seem to work.

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

    Piggy-Style

    I just signed up because I was having the same problem with my plugin, I see what the problem is too. When it tries to create the world it looks in the directory .C:\... instead of C:\... It adds a dot. Why does it do that?
     
  3. Offline

    Njol

    You're treating an absolute path as a relative path, thus a "./" is added (which marks a relative path).
    I guess it's caused by this line:
    Code:
    File destFolder = new File( new File(plugin.getConfig().getString("Config.CopyToWorld")).getAbsolutePath());
    Why do you create two file objects where one is enough?
     
  4. Offline

    Dreeass

    I use .getAbsolutePath() to get the path of the worldfile cause then it's a string, what else do I have to use?
     
  5. Offline

    Njol

    You should know best what your code does, but obviously you don't:
    You create a new File with the string from the config, get it's absolute path and then create another File instance with it. You only need to create the first File:
    Code:
    File destFolder = new File(plugin.getConfig().getString("Config.CopyToWorld"));
     
  6. Offline

    Dreeass

    I tried that too before but I get the same error, in a previous thread someone told me to use .getAbsolutePath()
     
  7. Offline

    Njol

    Did you manually put "D:\Scripting\Bukkit\Testserver\world_tsg\session.lock" in the config.yml? it should be "world_tsg/" only.
     
    Dreeass likes this.
  8. Offline

    Dreeass

    I put world_tsgdefault and tsg. I'll add the / when I'm home. Then I'll make another reply so you can see.

    Thanks, it works now!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
Thread Status:
Not open for further replies.

Share This Page