MySQL driver error

  • After careful consideration and due to limited usage, we’ve made the decision to discontinue the PaperMC forums. Moving forward, we recommend using Hangar for plugin uploads, and for all other community discussions and support, please join us on Discord.

itYedgk

New member
Jan 28, 2025
1
0
1
Any ideas how to fix that? I have tried everything tbh and still no positive output

plugins {
id("java")
id("com.gradleup.shadow") version "9.0.0-beta6"
}

group = "pl.warriormc"
version = "1.0-dev"

repositories {
mavenCentral()
gradlePluginPortal()

maven("https://repo.papermc.io/repository/maven-public/")
}

dependencies {
compileOnly("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
annotationProcessor("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")

implementation("com.zaxxer:HikariCP:6.2.1")
implementation("com.j256.ormlite:eek:rmlite-jdbc:6.1")
implementation("com.mysql:mysql-connector-j:9.1.0")
}

tasks.compileJava {
options.encoding = "UTF-8"
}

tasks.shadowJar {
minimize()
listOf(
"com.j256.ormlite",
"com.mysql"
).forEach { relocate(it, "pl.warriormc.ban.libs") }
}

@Subscribe
public void onProxyInitialize(ProxyInitializeEvent event) {
try {
DriverManager.registerDriver((Driver) Class.forName("com.mysql.cj.jdbc.Driver").getDeclaredConstructor().newInstance());
} catch (ReflectiveOperationException | SQLException e) {
throw new RuntimeException(e);
}
databaseFactory = new DatabaseFactory();
databaseFactory.connect("autorack.proxy.rlwy.net", 50454, "railway", "username", "password");
}

public void connect(String host, int port, String database, String username, String password) {
HikariDataSource dataSource = new HikariDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setJdbcUrl("jdbc:mysql://" + host + ":" + port + "/" + database + "?useSSL=true");
dataSource.setUsername(username);
dataSource.setPassword(password);
dataSource.setMaximumPoolSize(2);

dataSource.addDataSourceProperty("cachePrepStmts", true);
dataSource.addDataSourceProperty("prepStmtCacheSize", 250);
dataSource.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
dataSource.addDataSourceProperty("useServerPrepStmts", true);
dataSource.addDataSourceProperty("serverTimezone", "Europe/Warsaw");
try {
this.connectionSource = new DataSourceConnectionSource(dataSource, dataSource.getJdbcUrl());
} catch (Exception exception) {
throw new RuntimeException(exception);
}
}
 
Logs
https://pastebin.com/s2JwdWmv
Version Output
Velocity 3.4.0-SNAPSHOT (git-371e6860-b463)