NiklasEi / gamebox

Minecraft plugin with a vast selection of inventory games
http://gamebox.nikl.me
GNU General Public License v3.0
16 stars 13 forks source link

ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource #87

Closed resi23 closed 3 years ago

resi23 commented 3 years ago

Hi, you should take a look at the new commit to papermc main branch from yesterday!

https://github.com/PaperMC/Paper/issues/5473 https://github.com/PaperMC/Paper/pull/5474

Its some changes to mysql.

[00:32:24] [Craft Scheduler Thread - 1/WARN]: [GameBox] Plugin GameBox v3.3.0 generated an exception while executing task 274 java.lang.RuntimeException: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource at me.nikl.gamebox.common.zaxxer.hikari.util.UtilityElf.createInstance(UtilityElf.java:113) ~[?:?] at me.nikl.gamebox.common.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:316) ~[?:?] at me.nikl.gamebox.common.zaxxer.hikari.pool.PoolBase.(PoolBase.java:109) ~[?:?] at me.nikl.gamebox.common.zaxxer.hikari.pool.HikariPool.(HikariPool.java:108) ~[?:?] at me.nikl.gamebox.common.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[?:?] at me.nikl.gamebox.data.database.MysqlDB.load(MysqlDB.java:74) ~[?:?] at me.nikl.gamebox.GameBox.setUpMySQL(GameBox.java:274) ~[?:?] at me.nikl.gamebox.GameBox.loadDatabase(GameBox.java:248) ~[?:?] at me.nikl.gamebox.GameBox.access$1000(GameBox.java:50) ~[?:?] at me.nikl.gamebox.GameBox$2.run(GameBox.java:228) ~[?:?] at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Paper-588] at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) ~[patched_1.16.5.jar:git-Paper-588] at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.16.5.jar:git-Paper-588] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:?] at java.lang.Thread.run(Unknown Source) [?:?] Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource at java.net.URLClassLoader.findClass(Unknown Source) ~[?:?] at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:182) ~[patched_1.16.5.jar:git-Paper-588] at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:111) ~[patched_1.16.5.jar:git-Paper-588] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?] at me.nikl.gamebox.common.zaxxer.hikari.util.UtilityElf.createInstance(UtilityElf.java:100) ~[?:?] ... 15 more

Sandukhan commented 3 years ago

Ya since the 588 update a bunch of plugins that were using the older "com.mysql.jdbc.Driver" on my server had problems connecting to mysql.

Also makes it any difference using mariadb-server and client/connector instead of the mysql stuff? So far i was running with mariadb just fine.

resi23 commented 3 years ago

on my server run 10.4.12-MariaDB-1:10.4.12+maria~bionic

resi23 commented 3 years ago

My Solution:

me.nikl.gamebox.data.database.MysqlDB

change row 67 from

hikari.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");

to

hikari.setDataSourceClassName("com.mysql.cj.jdbc.MysqlDataSource");
NiklasEi commented 3 years ago

Thanks for the heads up! I currently do not have a test setup with MySQL and will need some time to set everything up again, but I'll get to it.

NiklasEi commented 3 years ago

Since I am still missing a decent test setup, could one of you please verify, that https://github.com/NiklasEi/gamebox/releases/download/v3.3.1/GameBox.jar solves this issue? I will upload the build to SpigotMC then.