PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.98k stars 2.32k forks source link

MySQL library isn't being loaded #6177

Closed ScottyRobinson closed 3 years ago

ScottyRobinson commented 3 years ago

Expected behavior

When using regular Spigot with plugins that've MySQL, they all work without issues.

Observed/Actual behavior

When installing and using Paper, the MYSQL driver doesn't seem to load causing all MySQL-based plugins to either fail or crash the server.

Here are a few plugins and their errors:

[16:20:16] [Server thread/INFO]: [com.zaxxer.hikari.HikariDataSource] HikariPool-1 - Starting...
[16:20:16] [Server thread/ERROR]: Unexpected error while loading AuctionHouse v2.18.3 c2: Disabling plugin!
java.lang.NullPointerException: Cannot invoke "com.zaxxer.hikari.HikariDataSource.getConnection()" because "this.hikari" is null
    at ca.tweetzy.auctionhouse.core.database.MySQLConnector.connect(MySQLConnector.java:53) ~[?:?]
    at ca.tweetzy.auctionhouse.core.database.DataMigrationManager.runMigrations(DataMigrationManager.java:33) ~[?:?]
    at ca.tweetzy.auctionhouse.AuctionHouse.onPluginEnable(AuctionHouse.java:134) ~[?:?]
    at ca.tweetzy.auctionhouse.core.TweetyPlugin.onEnable(TweetyPlugin.java:97) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.17.1.jar:git-Paper-98]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-98]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-98]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.17.1.jar:git-Paper-98]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.17.1.jar:git-Paper-98]
    at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:639) ~[patched_1.17.1.jar:git-Paper-98]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[patched_1.17.1.jar:git-Paper-98]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1126) ~[patched_1.17.1.jar:git-Paper-98]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[patched_1.17.1.jar:git-Paper-98]
[16:20:18] [Server thread/WARN]: 3 [Server thread] INFO com.bencodez.votingplugin.advancedcore.hikari.HikariDataSource - HikariPool-1 - Starting...
[16:20:18] [Server thread/WARN]: 9 [Server thread] WARN com.bencodez.votingplugin.advancedcore.hikari.util.DriverDataSource - Registered driver with driverClassName=com.mysql.cj.jdbc.Driver was not found, trying direct instantiation.
[16:20:18] [Server thread/WARN]: 18 [Server thread] INFO com.bencodez.votingplugin.advancedcore.hikari.HikariDataSource - HikariPool-1 - Start completed.

Steps/models to reproduce

Paper + MySQL based plugins?

Plugin list

Plugins (83): VoidWorldGenerator, MessageCoolDown, PlaceholderAPI, PlugMan, asCMD, Quests, PL-Hide, Shop, ViaVersion, NBTAPI, LuckPerms, UltraEconomy, ClearLag, SpaceChat, MessageAnnouncer, Playtimes, ProtocolLib, VoidSpawn, HamsterAPI, LibsDisguises, VotifierPlus, MVdWPlaceholderAPI, SnowCore, VoidGenerator, ExploitFixer, BeehivesPro, AntiForceOP, Vault, EpicHeads, HolographicDisplays, AuctionHouse, BungeeGuard, dynmap, UltimateRepairing, GUIPlus, Essentials, MineableSpawners, PyroMining, HoloExtension, WorldBorder, ItemEdit, VotingPlugin, FastAsyncWorldEdit (WorldEdit), DeluxeMenus, Chunkmaster, TAB, PrivateMessages, PlotSquared, WorldGuard, Brewery, ServerSigns, BetterRTP, EssentialsSpawn, WorldGuardExtraFlags, TitleManager, BetterFarming, ShopGUIPlus, PyroFishingPro, Multiverse-Core, Citizens, RainbowsPro, BattleLevels, EpicFurnaces, mcMMO, AutoPlant, PyroWeatherPro, ArmorStandTools, Rankup, EliteEnchantments, WarpSystem, LeaderHeadsRevamped, Multiverse-Inventories, BLP, CrateReloaded, BlockRegen, DeathChestPro, CoreArena, UltimateTimber, CMILib, Jobs, PreciousStones, UClans, Lands-Addon

Paper version

[16:19:52] [Server thread/INFO]: This server is running Paper version git-Paper-98 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: a4880d8)

Agreements

Other

No response

electronicboy commented 3 years ago

how did you start the server, etc; Server I primarily do stuff for uses a plugin that uses that core library thing and works without any issues at all

ScottyRobinson commented 3 years ago

how did you start the server, etc; Server I primarily do stuff for uses a plugin that uses that core library thing and works without any issues at all

How do you mean? Our Java parameters? command = "{JAVA}" -Xmx{MAX_MEMORY}M -Xms{START_MEMORY}M -Djline.terminal=jline.UnsupportedTerminal -jar "{JAR}" nogui we use multicraft as the panel.

It's odd, as everything works fine in Spigot just not Paper.

ScottyRobinson commented 3 years ago

More errors from other plugins:

13.07 18:11:27 [Server] INFO [UClans] Can not connect to a MySQL server! - Error: No suitable driver found for jdbc:mysql://127.0.0.1:3306/databae_name[UClans] >CAUTION< Connection not found, edit rows in Storage>mysql and reload the server!

Absolutely bizzare.

Ghost007CZ commented 3 years ago

I also cannot reproduce this. I'm not aware of any changes made to the MySQL's Connector/J library either. Which distribution of Java is the server running on?

NathanAdhitya commented 3 years ago

I also had an issue with this. Setup is Skript 2.6-beta2 and SQLibrary 7.1 (required by Skript to work with MySQL), connects to a MariaDB database hosted at the same machine. Server runs out of memory and hangs upon startup. Paper version is git-Paper-104. This issue does not happen if the server.jar is replaced with pure Spigot.

Docker environment: ghcr.io/pterodactyl/yolks:java_16 Startup Command: java -Xms3G -Xmx3G -Dterminal.jline=false -Dterminal.ansi=true -jar server.jar

Ghost007CZ commented 3 years ago

SQLibrary 7.1 was created for CraftBukkit 1.7.2 and requires com.mysql.jdbc.jdbc2.optional.MysqlDataSource class which has been moved to com.mysql.cj.jdbc.MysqlDataSource in Connector/J 8.0 The same might be true about plugins which had been used by the creator of this issue. The plugins are simply too old and require classes that are no longer present. See Changes in the Connector/J API or contact the devs of those problematic plugins. Not a Paper issue imo.

NathanAdhitya commented 3 years ago

SQLibrary 7.1 was created for CraftBukkit 1.7.2 and requires com.mysql.jdbc.jdbc2.optional.MysqlDataSource class which has been moved to com.mysql.cj.jdbc.MysqlDataSource in Connector/J 8.0 The same might be true about plugins which had been used by the creator of this issue. The plugins are simply too old and require classes that are no longer present. See Changes in the Connector/J API or contact the devs of those problematic plugins. Not a Paper issue imo.

Hm, I think otherwise. If it works with regular Spigot, it should also work with Paper. Though, I'll give it a try and mention it in Skript's issue tracker.

electronicboy commented 3 years ago

Spigot bundles an outdated and afaik practically unsupported version of the MySQL connector which has a security flaw in it, we have 0 interest in downgrading this library given the security implications induced, as well as the changes involved are things which no sane dev should be relying on (many of these breaking changes had been announced years ago and devs had years to migrate, as well as the driver manager already allowing a "not depending on a specific set of driver classes" mechanism which is pretty robust)