broccolai / tickets

GNU General Public License v3.0
27 stars 8 forks source link

[Bug] MySQL error on startup #46

Closed Silthus closed 3 years ago

Silthus commented 4 years ago

Thanks for the great plugin, I really like the idea of the Discord connection. However I get an SQL error when the plugin starts.

[10:30:42] [Server thread/INFO]: [PureTickets] Enabling PureTickets v3.1.1
[10:30:43] [Server thread/INFO]: [DB] Connecting to Database: mysql://db:3306/minecraft
[10:30:43] [Server thread/INFO]: [broccolai.tickets.lib.hikari.HikariDataSource] DB - Starting...
[10:30:43] [Server thread/INFO]: [broccolai.tickets.lib.hikari.HikariDataSource] DB - Start completed.
[10:30:43] [Server thread/INFO]: [PureTickets] Disabling PureTickets v3.1.1
[10:30:43] [Server thread/INFO]: [broccolai.tickets.lib.hikari.HikariDataSource] DB - Shutdown initiated...
[10:30:43] [Server thread/INFO]: [broccolai.tickets.lib.hikari.HikariDataSource] DB - Shutdown completed.
[10:30:43] [Server thread/ERROR]: Error occurred while enabling PureTickets v3.1.1 (Is it up to date?)
java.lang.NullPointerException: null
        at broccolai.tickets.lib.idb.DB.executeUpdate(DB.java:172) ~[?:?]
        at broccolai.tickets.storage.platforms.MySQL.setup(MySQL.java:71) ~[?:?]
        at broccolai.tickets.storage.SQLManager.<init>(SQLManager.java:44) ~[?:?]
        at broccolai.tickets.PureTickets.onEnable(PureTickets.java:31) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.4.jar:git-Paper-261]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.4.jar:git-Paper-261]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.4.jar:git-Paper-261]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.4.jar:git-Paper-261]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.4.jar:git-Paper-261]
        at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:468) ~[patched_1.16.4.jar:git-Paper-261]
        at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:239) ~[patched_1.16.4.jar:git-Paper-261]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:939) ~[patched_1.16.4.jar:git-Paper-261]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:177) ~[patched_1.16.4.jar:git-Paper-261]
        at java.lang.Thread.run(Unknown Source) [?:?]

The connection to the database however was successful and the tables were created.

image

================================
Server Information
================================

Bukkit Version: 1.16.4-R0.1-SNAPSHOT
Implementation: Paper git-Paper-261 (MC: 1.16.4)
Player Count: 0/20
Server Class Source: file:/data/cache/patched_1.16.4.jar
Spawning: 
        Ambient Spawn Limit: 15
        Animal Spawn Limit: 10
        Monster Spawn Limit: 70
        Ticks per Animal Spawn: 400
        Ticks per Monster Spawn: 1
Configuration: 
        Nether Enabled?: true
        The End Enabled?: true
        Generate Structures?: true
        Flight Allowed?: false
        Connection Throttle: 4000
        Idle Timeout: 0
        Shutdown Message: Server closed
        Default Game Mode: SURVIVAL
        Main World Type: default
        View Distance: 10
Protection: Spawn Radius: 16

================================
Plugins
================================

Plugin Count: 13
Plugin: LuckPerms: 
        Enabled?: true
        Full Name: LuckPerms v5.2.23
        Version: 5.2.23
        Website: https://luckperms.net
        Description: A permissions plugin
        Authors: Luck
        Load Before: Vault
        Dependencies: 
        Soft Dependencies: 
                LilyPad-Connect
                ViaVersion
        Folder: /data/plugins/LuckPerms
        Entry Point: me.lucko.luckperms.bukkit.LPBukkitBootstrap
        Class: me.lucko.luckperms.bukkit.LPBukkitBootstrap
        Class Source: file:/data/plugins/LuckPerms-Bukkit-5.2.23.jar
Plugin: ebean-wrapper: 
        Enabled?: true
        Full Name: ebean-wrapper v2.3.2
        Version: 2.3.2
        Website: null
        Description: null
        Authors: Silthus
        Load Before: 
        Dependencies: 
        Soft Dependencies: 
        Folder: /data/plugins/ebean-wrapper
        Entry Point: net.silthus.ebean.EbeanWrapperPlugin
        Class: net.silthus.ebean.EbeanWrapperPlugin
        Class Source: file:/data/plugins/ebean-wrapper-2.3.2.jar
Plugin: VoxelSniper: 
        Enabled?: true
        Full Name: VoxelSniper v6.1.2
        Version: 6.1.2
        Website: http://www.voxelwiki.com/minecraft/VoxelSniper
        Description: World editing from ingame using 3D brushes.
        Authors: 
                przerwap
                MikeMatrix
                Gavjenks
                giltwist
                psanker
                Deamon5550
                DivineRage
        Load Before: 
        Dependencies: 
        Soft Dependencies: VoxelModPackPlugin
        Folder: /data/plugins/VoxelSniper
        Entry Point: com.thevoxelbox.voxelsniper.VoxelSniper
        Class: com.thevoxelbox.voxelsniper.VoxelSniper
        Class Source: file:/data/plugins/VoxelSniper-6.1.2.jar
Plugin: PureTickets: 
        Enabled?: false
        Full Name: PureTickets v3.1.1
        Version: 3.1.1
        Website: null
        Description: null
        Authors: 
        Load Before: 
        Dependencies: 
        Soft Dependencies: 
        Folder: /data/plugins/PureTickets
        Entry Point: broccolai.tickets.PureTickets
        Class: broccolai.tickets.PureTickets
        Class Source: file:/data/plugins/PureTickets.jar
Plugin: Vault: 
        Enabled?: true
        Full Name: Vault v1.7.3-b131
        Version: 1.7.3-b131
        Website: https://dev.bukkit.org/projects/vault
        Description: Vault is a Permissions & Economy API to allow plugins to more easily hook into these systems without needing to hook each individual system themselves.
        Authors: 
                cereal
                Sleaker
                mung3r
        Load Before: 
        Dependencies: 
        Soft Dependencies: 
        Folder: /data/plugins/Vault
        Entry Point: net.milkbowl.vault.Vault
        Class: net.milkbowl.vault.Vault
        Class Source: file:/data/plugins/Vault.jar
Plugin: ProtocolLib: 
        Enabled?: true
        Full Name: ProtocolLib v4.6.0-SNAPSHOT-b482
        Version: 4.6.0-SNAPSHOT-b482
        Website: null
        Description: Provides read/write access to the Minecraft protocol.
        Authors: 
                dmulloy2
                comphenix
        Load Before: 
        Dependencies: 
        Soft Dependencies: 
        Folder: /data/plugins/ProtocolLib
        Entry Point: com.comphenix.protocol.ProtocolLib
        Class: com.comphenix.protocol.ProtocolLib
        Class Source: file:/data/plugins/ProtocolLib.jar
Plugin: dynmap: 
        Enabled?: true
        Full Name: dynmap v3.1-beta4-421
        Version: 3.1-beta4-421
        Website: https://www.reddit.com/r/Dynmap/
        Description: null
        Authors: mikeprimm
        Load Before: 
        Dependencies: 
        Soft Dependencies: 
                Permissions
                PermissionEx
                bPermissions
                PermissionsBukkit
                GroupManager
                LuckPerms
                Vault
                SkinsRestorer
        Folder: /data/plugins/dynmap
        Entry Point: org.dynmap.bukkit.DynmapPlugin
        Class: org.dynmap.bukkit.DynmapPlugin
        Class Source: file:/data/plugins/Dynmap-3.1-beta4-spigot.jar
Plugin: WorldEdit: 
        Enabled?: true
        Full Name: WorldEdit v7.2.0+a51fa43
        Version: 7.2.0+a51fa43
        Website: null
        Description: null
        Authors: 
        Load Before: 
        Dependencies: 
        Soft Dependencies: Vault
        Folder: /data/plugins/WorldEdit
        Entry Point: com.sk89q.worldedit.bukkit.WorldEditPlugin
        Class: com.sk89q.worldedit.bukkit.WorldEditPlugin
        Class Source: file:/data/plugins/worldedit-bukkit-7.2.0-dist.jar
Plugin: Essentials: 
        Enabled?: true
        Full Name: Essentials v2.18.1.0
        Version: 2.18.1.0
        Website: https://essentialsx.net/
        Description: Provides an essential, core set of commands for Bukkit.
        Authors: 
                Zenexer
                ementalo
                Aelux
                Brettflan
                KimKandor
                snowleo
                ceulemans
                Xeology
                KHobbits
                md_5
                Iaccidentally
                drtshock
                vemacs
                SupaHam
                md678685
        Load Before: 
        Dependencies: 
        Soft Dependencies: 
                Vault
                LuckPerms
        Folder: /data/plugins/Essentials
        Entry Point: com.earth2me.essentials.Essentials
        Class: com.earth2me.essentials.Essentials
        Class Source: file:/data/plugins/EssentialsX-2.18.1.0.jar
Plugin: AntiCheatReloaded: 
        Enabled?: true
        Full Name: AntiCheatReloaded v1.9.5
        Version: 1.9.5
        Website: null
        Description: AntiCheatReloaded helps easily identify and block malicious users on your server.
        Authors: Rammelkast
        Load Before: 
        Dependencies: ProtocolLib
        Soft Dependencies: 
        Folder: /data/plugins/AntiCheatReloaded
        Entry Point: com.rammelkast.anticheatreloaded.AntiCheatReloaded
        Class: com.rammelkast.anticheatreloaded.AntiCheatReloaded
        Class Source: file:/data/plugins/AntiCheatReloaded.jar
Plugin: WorldGuard: 
        Enabled?: true
        Full Name: WorldGuard v7.0.4+f7ff984
        Version: 7.0.4+f7ff984
        Website: null
        Description: null
        Authors: 
        Load Before: 
        Dependencies: WorldEdit
        Soft Dependencies: CommandBook
        Folder: /data/plugins/WorldGuard
        Entry Point: com.sk89q.worldguard.bukkit.WorldGuardPlugin
        Class: com.sk89q.worldguard.bukkit.WorldGuardPlugin
        Class Source: file:/data/plugins/worldguard-bukkit-7.0.4.jar
Plugin: CoreProtect: 
        Enabled?: true
        Full Name: CoreProtect v19.2
        Version: 19.2
        Website: http://coreprotect.net
        Description: 
                Provides block protection for your server.

        Authors: Intelli
        Load Before: 
        Dependencies: 
        Soft Dependencies: WorldEdit
        Folder: /data/plugins/CoreProtect
        Entry Point: net.coreprotect.CoreProtect
        Class: net.coreprotect.CoreProtect
        Class Source: file:/data/plugins/CoreProtect-19.2.jar
Plugin: LWC: 
        Enabled?: true
        Full Name: LWC v2.2.6-2d10269
        Version: 2.2.6-2d10269
        Website: https://www.spigotmc.org/resources/lwc-extended.69551/
        Description: 
                Inventory protection & management utilizing SQLite or MySQL as its backend Other blocks can also be protected individually, if configured.

        Authors: 
                Hidendra
                pop4959
                Me_Goes_RAWR
        Load Before: 
        Dependencies: 
        Soft Dependencies: 
                Vault
                WorldEdit
                WorldGuard
                Towny
                Factions
        Folder: /data/plugins/LWC
        Entry Point: com.griefcraft.lwc.LWCPlugin
        Class: com.griefcraft.lwc.LWCPlugin
        Class Source: file:/data/plugins/LWCX-2.2.6.jar
broccolai commented 4 years ago

Hmm, not sure what's causing this. On the master branch I'm not printing all SQL errors for some reason. Can you try this version: download link

And let me know what the stack trace / error is?

Thank you!

Silthus commented 4 years ago

Thanks for the quick answer. Here is the stacktrace from the patched jar you provided.

It seems to be the same error that CoreProtect had and has to do with the latest MariaDB Version: https://www.spigotmc.org/resources/coreprotect.8631/update?update=369582

[10:43:12] [Server thread/INFO]: [broccolai.tickets.lib.hikari.HikariDataSource] DB - Starting...
[10:43:12] [Server thread/INFO]: [broccolai.tickets.lib.hikari.HikariDataSource] DB - Start completed.
[10:43:12] [Server thread/WARN]: java.sql.SQLException: Malformed communication packet
[10:43:12] [Server thread/WARN]:        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)
[10:43:12] [Server thread/WARN]:        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933)
[10:43:12] [Server thread/WARN]:        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869)
[10:43:12] [Server thread/WARN]:        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
[10:43:12] [Server thread/WARN]:        at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1281)
[10:43:12] [Server thread/WARN]:        at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:787)
[10:43:12] [Server thread/WARN]:        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2023)
[10:43:12] [Server thread/WARN]:        at broccolai.tickets.lib.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
[10:43:12] [Server thread/WARN]:        at broccolai.tickets.lib.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
[10:43:12] [Server thread/WARN]:        at broccolai.tickets.lib.idb.DbStatement.execute(DbStatement.java:274)
[10:43:12] [Server thread/WARN]:        at broccolai.tickets.lib.idb.Database.getFirstColumn(Database.java:131)
[10:43:12] [Server thread/WARN]:        at broccolai.tickets.lib.idb.DB.getFirstColumn(DB.java:96)
[10:43:12] [Server thread/WARN]:        at broccolai.tickets.storage.platforms.MySQL.setup(MySQL.java:44)
[10:43:12] [Server thread/WARN]:        at broccolai.tickets.storage.SQLManager.setup(SQLManager.java:30)
[10:43:12] [Server thread/WARN]:        at broccolai.tickets.PureTickets.onEnable(PureTickets.java:30)
[10:43:12] [Server thread/WARN]:        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263)
[10:43:12] [Server thread/WARN]:        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380)
[10:43:12] [Server thread/WARN]:        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483)
[10:43:12] [Server thread/WARN]:        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501)
[10:43:12] [Server thread/WARN]:        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415)
[10:43:12] [Server thread/WARN]:        at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:468)
[10:43:12] [Server thread/WARN]:        at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:239)
[10:43:12] [Server thread/WARN]:        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:940)
[10:43:12] [Server thread/WARN]:        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:177)
[10:43:12] [Server thread/WARN]:        at java.base/java.lang.Thread.run(Unknown Source)
[10:43:12] [Server thread/INFO]: [PureTickets] Disabling PureTickets v3.1.2
[10:43:12] [Server thread/INFO]: [broccolai.tickets.lib.hikari.HikariDataSource] DB - Shutdown initiated...
[10:43:12] [Server thread/INFO]: [broccolai.tickets.lib.hikari.HikariDataSource] DB - Shutdown completed.
broccolai commented 4 years ago

Hmmm, I've seen a few plugins with this. Not sure the best way to go about fixing it, I'll need to set up a mariadb instance locally. For now, can you try reverting your mariadb driver version to an earlier date to see if that fixes it? I'm also interested to see if it works on the jdbi rewrite in the dev branch which should be stable in a few days.

Thank you :)

Silthus commented 4 years ago

There is a docker image (which we use on our server) that you can use to try it out locally: https://hub.docker.com/_/mariadb

Also I don't know if it helps or is worth the effor, but I have an ebean-wrapper that can handle all of the SQL stuff for you and allows working with plain DTOs: https://github.com/silthus/ebean-wrapper

broccolai commented 3 years ago

Should be fixed in 5.0