apache/seatunnel · warning
Failed to load JDBC driver {}
Error message
Failed to load JDBC driver {} What it means
StarRocksSink's constructor tries to preload the MySQL Connector/J driver (com.mysql.cj.jdbc.Driver) into DriverManager for JDBC-based save-mode operations. If the class is missing or fails to initialize, this warning is logged and construction continues; later JDBC operations may fail with 'No suitable driver'.
Source
Thrown at seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/sink/StarRocksSink.java:70
private final SinkConfig sinkConfig;
private final DataSaveMode dataSaveMode;
private final SchemaSaveMode schemaSaveMode;
private final CatalogTable catalogTable;
private final Map<String, String> tableOptions;
public StarRocksSink(
SinkConfig sinkConfig, CatalogTable catalogTable, Map<String, String> tableOptions) {
this.sinkConfig = sinkConfig;
this.tableSchema = catalogTable.getTableSchema();
this.catalogTable = catalogTable;
this.tableOptions = tableOptions;
this.dataSaveMode = sinkConfig.getDataSaveMode();
this.schemaSaveMode = sinkConfig.getSchemaSaveMode();
// Load the JDBC driver in to DriverManager
try {
Class.forName("com.mysql.cj.jdbc.Driver");
} catch (Exception e) {
log.warn("Failed to load JDBC driver {}", "com.mysql.cj.jdbc.Driver", e);
}
}
@Override
public String getPluginName() {
return StarRocksCatalogFactory.IDENTIFIER;
}
@Override
public StarRocksSinkWriter createWriter(SinkWriter.Context context) {
// Load the JDBC driver in to DriverManager
try {
Class.forName("com.mysql.cj.jdbc.Driver");
} catch (Exception e) {
log.warn("Failed to load JDBC driver {}", "com.mysql.cj.jdbc.Driver", e);
}
TablePath sinkTablePath = catalogTable.getTablePath();
return new StarRocksSinkWriter(context, sinkConfig, tableSchema, sinkTablePath);View on GitHub (pinned to cf67b549a7)
Solutions
- Download mysql-connector-java-8.x (mysql-connector-j) into $SEATUNNEL_HOME/plugins/<connector>/lib or connectors dir and retry
- Verify the jar contains com/mysql/cj/jdbc/Driver.class (unzip -l)
- If schema save modes are unused and stream load only is needed, the warning can be ignored, but JDBC save-mode handlers will fail later
Defensive patterns
Strategy: validation
Validate before calling
try {
Class.forName("com.mysql.cj.jdbc.Driver");
} catch (ClassNotFoundException e) {
throw new IllegalStateException("mysql-connector-j 8.x jar missing from plugin classpath", e);
} Prevention
- Run install-plugin.sh or manually place mysql-connector-j in the connector lib dir
- Verify the jar exists on every node, not just the coordinator
- Use driver 8.x (com.mysql.cj), not legacy 5.x (com.mysql.jdbc)
When it happens
Trigger: Instantiating StarRocksSink when the mysql-connector-java jar is not on the classpath or the driver class fails static initialization (incompatible java.sql/ServiceLoader environment).
Common situations: Missing connector jar in the plugin directory (install-plugin.sh not run or jar excluded); shaded/fat-jar conflicts; using a Driver 5.x (com.mysql.jdbc.Driver) instead of 8.x.
Related errors
- Failed to load JDBC driver com.mysql.cj.jdbc.Driver
- Failed to load JDBC driver com.mysql.cj.jdbc.Driver
- DRIVER_NOT_FOUND
- CONNECT_FAILED
- CLASS_NOT_FOUND
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/1d8778ad67e10ecc.
Report an issue: GitHub.