MobHunting

MobHunting

114k Downloads

Plugin can't create tables in MySQL

luisbustalu opened this issue ยท 2 comments

commented

Hey! Some time ago, I had to disable MobHunting because the plugin takes too long closing the SQLite database, my script detects as the server crashes, and kills the process. I wanted to switch it to MySQL, and tried. When I startup the server, I get this error:

[19:37:39] [Server thread/INFO]: [MobHunting] MobHunting is using Essentials Economy via Vault as Economy Provider
[19:37:39] [Server thread/WARN]: one.lindegaard.Core.storage.DataStoreException: java.sql.SQLException: Can't create table `minecraft`.`mh_Daily` (errno: 150 "Foreign key constraint is incorrectly formed")
[19:37:39] [Server thread/WARN]: 	at one.lindegaard.MobHunting.storage.DatabaseDataStore.initialize(DatabaseDataStore.java:305)
[19:37:39] [Server thread/WARN]: 	at one.lindegaard.MobHunting.MobHunting.onEnable(MobHunting.java:193)
[19:37:39] [Server thread/WARN]: 	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263)
[19:37:39] [Server thread/WARN]: 	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380)
[19:37:39] [Server thread/WARN]: 	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483)
[19:37:39] [Server thread/WARN]: 	at org.bukkit.craftbukkit.v1_16_R1.CraftServer.enablePlugin(CraftServer.java:500)
[19:37:39] [Server thread/WARN]: 	at org.bukkit.craftbukkit.v1_16_R1.CraftServer.enablePlugins(CraftServer.java:414)
[19:37:39] [Server thread/WARN]: 	at net.minecraft.server.v1_16_R1.MinecraftServer.loadWorld(MinecraftServer.java:471)
[19:37:39] [Server thread/WARN]: 	at net.minecraft.server.v1_16_R1.DedicatedServer.init(DedicatedServer.java:241)
[19:37:39] [Server thread/WARN]: 	at net.minecraft.server.v1_16_R1.MinecraftServer.v(MinecraftServer.java:941)
[19:37:39] [Server thread/WARN]: 	at net.minecraft.server.v1_16_R1.MinecraftServer.lambda$a$0(MinecraftServer.java:177)
[19:37:39] [Server thread/WARN]: 	at java.lang.Thread.run(Thread.java:748)
[19:37:39] [Server thread/WARN]: Caused by: java.sql.SQLException: Can't create table `minecraft`.`mh_Daily` (errno: 150 "Foreign key constraint is incorrectly formed")
[19:37:39] [Server thread/WARN]: 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)
[19:37:39] [Server thread/WARN]: 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933)
[19:37:39] [Server thread/WARN]: 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869)
[19:37:39] [Server thread/WARN]: 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
[19:37:39] [Server thread/WARN]: 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675)
[19:37:39] [Server thread/WARN]: 	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
[19:37:39] [Server thread/WARN]: 	at com.mysql.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1536)
[19:37:39] [Server thread/WARN]: 	at com.mysql.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2585)
[19:37:39] [Server thread/WARN]: 	at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1464)
[19:37:39] [Server thread/WARN]: 	at one.lindegaard.MobHunting.storage.MySQLDataStore.setupV8Tables(MySQLDataStore.java:1698)
[19:37:39] [Server thread/WARN]: 	at one.lindegaard.MobHunting.storage.DatabaseDataStore.initialize(DatabaseDataStore.java:287)
[19:37:39] [Server thread/WARN]: 	... 11 more
[19:37:39] [Server thread/ERROR]: Error occurred while enabling MobHunting v7.5.1 (Is it up to date?)
java.lang.NullPointerException: null
	at one.lindegaard.MobHunting.storage.DatabaseDataStore.shutdown(DatabaseDataStore.java:336) ~[?:?]
	at one.lindegaard.MobHunting.MobHunting.onEnable(MobHunting.java:197) ~[?:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.1.jar:git-Paper-131]
	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.1.jar:git-Paper-131]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.1.jar:git-Paper-131]
	at org.bukkit.craftbukkit.v1_16_R1.CraftServer.enablePlugin(CraftServer.java:500) ~[patched_1.16.1.jar:git-Paper-131]
	at org.bukkit.craftbukkit.v1_16_R1.CraftServer.enablePlugins(CraftServer.java:414) ~[patched_1.16.1.jar:git-Paper-131]
	at net.minecraft.server.v1_16_R1.MinecraftServer.loadWorld(MinecraftServer.java:471) ~[patched_1.16.1.jar:git-Paper-131]
	at net.minecraft.server.v1_16_R1.DedicatedServer.init(DedicatedServer.java:241) ~[patched_1.16.1.jar:git-Paper-131]
	at net.minecraft.server.v1_16_R1.MinecraftServer.v(MinecraftServer.java:941) ~[patched_1.16.1.jar:git-Paper-131]
	at net.minecraft.server.v1_16_R1.MinecraftServer.lambda$a$0(MinecraftServer.java:177) ~[patched_1.16.1.jar:git-Paper-131]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
[19:37:39] [Server thread/INFO]: [MobHunting] Disabling MobHunting v7.5.1

Seems like MobHunting isn't able to create the MySQL tables properly. I'm using MariaDB, and Paper as server software.

commented

I dont know how to test this, because I dont know to reproduce the error. I have googled the problem and I hope i found the correct solution.

Could you please test this build?