Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL and HikariCP issue #1174

Closed
iGabyTM opened this issue Feb 17, 2021 · 1 comment
Closed

MySQL and HikariCP issue #1174

iGabyTM opened this issue Feb 17, 2021 · 1 comment

Comments

@iGabyTM
Copy link

iGabyTM commented Feb 17, 2021

So I'm trying to use Exposed with MySQL and HikariCP but I get the following error, any idea why and how can I fix it?

Code

    private lateinit var database: Database

    init {
        init(plugin)
    }

    private fun init(plugin: UhcCoreMysqlPlugin) {
        val config = HikariConfig().apply {
            jdbcUrl         = "jdbc:mysql://localhost/uhccore_mysql"
            driverClassName = "com.mysql.cj.jdbc.Driver"
            username        = "root"
            maximumPoolSize = 10
        }

        database = Database.connect(HikariDataSource(config)) // Line 32
    }

build.gradle

    implementation "org.jetbrains.exposed:exposed-core:${project.exposedVersion}"
    implementation "org.jetbrains.exposed:exposed-dao:${project.exposedVersion}"
    implementation "org.jetbrains.exposed:exposed-jdbc:${project.exposedVersion}"

    implementation 'com.zaxxer:HikariCP:4.0.2'
    implementation 'mysql:mysql-connector-java:8.0.23'

Error

[13:11:38 INFO]: [me.gabytm.minecraftc.uhccoremysql.libs.hikari.HikariDataSource] HikariPool-1 - Starting...
[13:11:38 INFO]: [me.gabytm.minecraftc.uhccoremysql.libs.hikari.HikariDataSource] HikariPool-1 - Start completed.
[13:11:38 ERROR]: Error occurred while enabling UhcCore-MySQL v1.0.0 (Is it up to date?)
java.lang.ExceptionInInitializerError: null
	at me.gabytm.minecraftc.uhccoremysql.storage.StorageController$database$2.invoke(StorageController.kt:32) ~[?:?]
	at me.gabytm.minecraftc.uhccoremysql.storage.StorageController$database$2.invoke(StorageController.kt:13) ~[?:?]
	at me.gabytm.minecraftc.uhccoremysql.libs.kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) ~[?:?]
	at me.gabytm.minecraftc.uhccoremysql.storage.StorageController.getDatabase(StorageController.kt) ~[?:?]
	at me.gabytm.minecraftc.uhccoremysql.storage.StorageController.init(StorageController.kt:76) ~[?:?]
	at me.gabytm.minecraftc.uhccoremysql.storage.StorageController.<init>(StorageController.kt:72) ~[?:?]
	at me.gabytm.minecraftc.uhccoremysql.UhcCoreMysqlPlugin.onEnable(UhcCoreMysqlPlugin.kt:12) ~[?:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.12.2.jar:git-Paper-1618]
	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:316) ~[patched_1.12.2.jar:git-Paper-1618]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) ~[patched_1.12.2.jar:git-Paper-1618]
	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:395) ~[patched_1.12.2.jar:git-Paper-1618]
	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:344) ~[patched_1.12.2.jar:git-Paper-1618]
	at net.minecraft.server.v1_12_R1.MinecraftServer.t(MinecraftServer.java:442) ~[patched_1.12.2.jar:git-Paper-1618]
	at net.minecraft.server.v1_12_R1.MinecraftServer.l(MinecraftServer.java:403) ~[patched_1.12.2.jar:git-Paper-1618]
	at net.minecraft.server.v1_12_R1.MinecraftServer.a(MinecraftServer.java:341) ~[patched_1.12.2.jar:git-Paper-1618]
	at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:289) ~[patched_1.12.2.jar:git-Paper-1618]
	at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:616) ~[patched_1.12.2.jar:git-Paper-1618]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Caused by: java.lang.IllegalStateException: Can't load implementation for DatabaseConnectionAutoRegistration
	at me.gabytm.minecraftc.uhccoremysql.libs.exposed.sql.Database.<clinit>(Database.kt:62) ~[?:?]
	... 18 more
@iGabyTM
Copy link
Author

iGabyTM commented Feb 17, 2021

#748 removing the relocation fixed this

@iGabyTM iGabyTM closed this as completed Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant