Hi. My plugin run fine but after few hours calling one class generate this error java.lang.NoClassDefFoundError I use: new ConfigChunk(targetchunk).access Can somebody tell my how to solve this and why it's running good but after some hours of server running it's broke ? I using still #1060 ConfigChung class declaration: public class ConfigChunk { public Integer id_chunk=0; .... some varilables..... public Integer access=1; public ConfigChunk(OwnedChunk ownedchunk){ ...... Database load.... access = owner_result.getInt("access"); } } Thanks
Could you give us the whole stacktrace? It will tell us the line it happened, and what was the class it didn't find... And I suppose you defined or imported all of your classes? Anything happens in your plugin after a few hours?
In the morning I start localhost server and in evening try why plugin don't work and I see this error Error log: 2011-09-20 20:49:28 [SEVERE] Could not pass event BLOCK_BREAK to AutoRegionGuard java.lang.NoClassDefFoundError: sk/kuk/arg/ConfigChunk at sk.kuk.arg.RegionHandler.CanBuildHere(RegionHandler.java:413) at sk.kuk.arg.RegionHandler.CanBuildHere(RegionHandler.java:400) at sk.kuk.arg.listener.block.ARGBlockListener.onBlockBreak(ARGBlockListener.java:100) at org.bukkit.plugin.java.JavaPluginLoader$37.execute(JavaPluginLoader.java:497) at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:338) at net.minecraft.server.ItemInWorldManager.c(ItemInWorldManager.java:157) at net.minecraft.server.ItemInWorldManager.a(ItemInWorldManager.java:121) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:481) at net.minecraft.server.Packet14BlockDig.a(SourceFile:42) at net.minecraft.server.NetworkManager.b(NetworkManager.java:226) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:89) at net.minecraft.server.NetworkListenThread.a(SourceFile:105) at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:454) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:363) at net.minecraft.server.ThreadServerApplication.run(SourceFile:422) Code of Region Handler: public boolean CanBuildHere(String player_name, OwnedChunk targetchunk) { String playername = player_name.toLowerCase(); String owner=ClaimCheck(targetchunk); if (owner.equalsIgnoreCase(playername)==true){ return true; } (line 413) if (plugin.FriendHandler.isafriend(playername, owner,new ConfigChunk(targetchunk).access)) return true; return false; } And ConfigChunk class : package sk.kuk.arg; import java.sql.ResultSet; import java.sql.SQLException; public class ConfigChunk { public Integer id_chunk=0; public Integer fire=0; public Integer explode=0; public Integer door=0; public Integer store=0; public Integer access=1; public Integer pitstone=0; public Integer redstone=0; public String owner=""; public String name=""; public String text=""; public ConfigChunk(OwnedChunk ownedchunk){ ARG plugin = My_Reference.get_my_ref(); String query = "SELECT LOWER(owner) AS owner,id_chunk,fire,pitstone,redstone,explode,door,store,access,name,text FROM chunk WHERE world='" + ownedchunk.world.toLowerCase() +"' AND x='" + ownedchunk.chunk_x + "' AND y='" + ownedchunk.chunk_y + "';"; ResultSet owner_result = plugin.sqlHandler.sqlQuery(query); try { if (owner_result != null && owner_result.next()) { owner = owner_result.getString("owner"); name = owner_result.getString("name"); text = owner_result.getString("text"); id_chunk = owner_result.getInt("id_chunk"); fire = owner_result.getInt("fire"); pitstone = owner_result.getInt("pitstone"); redstone = owner_result.getInt("redstone"); explode = owner_result.getInt("explode"); door = owner_result.getInt("door"); store = owner_result.getInt("store"); access = owner_result.getInt("access"); } } catch (SQLException e) { e.printStackTrace(); } } }
You should avoid using caps for method's first letter. Keep them for classes, it's a universal convention. Apart from that, the only thing I can tbink of is a sql error (maybe time out?) but I don't see how it would create this error... Bad luck!
First I thin database lost connection but I have in plugin other methods with loading data from DB and it's working. And I try stop mysql server and it's produce other type of error. if error come on start i know I doing something wrong but plugin working good ... first few hours (now running 2:30 normali)