apache/seatunnel · warning
Failed to load JDBC driver com.mysql.cj.jdbc.Driver
Error message
Failed to load JDBC driver com.mysql.cj.jdbc.Driver
What it means
DorisSourceFactory.createSource registers the MySQL JDBC driver via Class.forName before building the Doris source and its catalog. Failure to locate the driver class is logged as this warning; source creation continues but catalog operations that require JDBC (database/table discovery, schema inference) will fail downstream.
Source
Thrown at seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/source/DorisSourceFactory.java:87
.optional(DorisSourceOptions.DORIS_REQUEST_QUERY_TIMEOUT_S)
.optional(DorisSourceOptions.DORIS_REQUEST_RETRIES)
.optional(DorisSourceOptions.DORIS_DESERIALIZE_ARROW_ASYNC)
.optional(DorisSourceOptions.DORIS_DESERIALIZE_QUEUE_SIZE)
.optional(DorisSourceOptions.DORIS_READ_FIELD)
.optional(DorisSourceOptions.QUERY_PORT)
.optional(DorisSourceOptions.DORIS_BATCH_SIZE)
.optional(DorisSourceOptions.DORIS_EXEC_MEM_LIMIT)
.build();
}
@Override
public <T, SplitT extends SourceSplit, StateT extends Serializable>
TableSource<T, SplitT, StateT> createSource(TableSourceFactoryContext 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);
}
DorisSourceConfig dorisSourceConfig = DorisSourceConfig.of(context.getOptions());
List<DorisTableConfig> dorisTableConfigList = dorisSourceConfig.getTableConfigList();
Map<TablePath, DorisSourceTable> dorisSourceTables = new HashMap<>();
DorisCatalogFactory dorisCatalogFactory = new DorisCatalogFactory();
try (DorisCatalog catalog =
(DorisCatalog) dorisCatalogFactory.createCatalog("doris", context.getOptions())) {
catalog.open();
for (DorisTableConfig dorisTableConfig : dorisTableConfigList) {
CatalogTable table;
TablePath tablePath = TablePath.of(dorisTableConfig.getTableIdentifier());
String readFields = dorisTableConfig.getReadField();
try {
List<String> readFiledList = null;
if (StringUtils.isNotBlank(readFields)) {
readFiledList =
Arrays.stream(readFields.split(","))View on GitHub (pinned to cf67b549a7)
Solutions
- Place mysql-connector-java/mysql-connector-j 8.x jar into $SEATUNNEL_HOME/lib on every node and restart the cluster.
- For Flink/Spark translation, also add the driver to the engine's lib or use `-C` classpath options.
- Check the warning's stack trace to distinguish ClassNotFoundException from NoClassDefFoundError (version conflict).
- Remove duplicate/incompatible MySQL driver jars that may shadow the correct one.
Example fix
// before sh bin/install-plugin.sh --connectors connector-doris # driver not bundled // after cp mysql-connector-java-8.0.28.jar $SEATUNNEL_HOME/lib/ && sh bin/seatunnel-cluster.sh -d
Defensive patterns
Strategy: validation
Validate before calling
try { Class.forName("com.mysql.cj.jdbc.Driver"); } catch (ClassNotFoundException e) { throw new IllegalStateException("Install mysql-connector-j in $SEATUNNEL_HOME/lib before running Doris source jobs"); } Prevention
- Bundle the MySQL driver in your deployment image
- Verify driver visibility in Flink/Spark child-first classloader setups
- Re-run install-plugin.sh plus driver copy after version upgrades
When it happens
Trigger: Calling createSource (when a Doris source table is instantiated during job graph construction) with the MySQL Connector/J jar absent from the runtime classpath.
Common situations: Driver jar not installed on worker nodes; only the connector jar deployed via `install-plugin.sh`; Flink/Spark classloader isolation hiding $SEATUNNEL_HOME/lib jars; switching MySQL driver versions and dropping the old jar.
Related errors
- Failed to load JDBC driver com.mysql.cj.jdbc.Driver
- Failed to load JDBC driver com.mysql.cj.jdbc.Driver
- Failed to load JDBC driver {}
- Error reading MySQL variables:
- Unexpected error while connecting to MySQL and looking at GT
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/b5f5769f8df83c5e.
Report an issue: GitHub.