{"record":{"id":"b5f5769f8df83c5e","repo":"apache/seatunnel","slug":"failed-to-load-jdbc-driver-com-mysql-cj-jdbc-drive-b5f576","errorCode":null,"errorMessage":"Failed to load JDBC driver com.mysql.cj.jdbc.Driver ","messagePattern":"Failed to load JDBC driver com\\.mysql\\.cj\\.jdbc\\.Driver ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/source/DorisSourceFactory.java","lineNumber":87,"sourceCode":"                .optional(DorisSourceOptions.DORIS_REQUEST_QUERY_TIMEOUT_S)\n                .optional(DorisSourceOptions.DORIS_REQUEST_RETRIES)\n                .optional(DorisSourceOptions.DORIS_DESERIALIZE_ARROW_ASYNC)\n                .optional(DorisSourceOptions.DORIS_DESERIALIZE_QUEUE_SIZE)\n                .optional(DorisSourceOptions.DORIS_READ_FIELD)\n                .optional(DorisSourceOptions.QUERY_PORT)\n                .optional(DorisSourceOptions.DORIS_BATCH_SIZE)\n                .optional(DorisSourceOptions.DORIS_EXEC_MEM_LIMIT)\n                .build();\n    }\n\n    @Override\n    public <T, SplitT extends SourceSplit, StateT extends Serializable>\n            TableSource<T, SplitT, StateT> createSource(TableSourceFactoryContext context) {\n        // Load the JDBC driver in to DriverManager\n        try {\n            Class.forName(\"com.mysql.cj.jdbc.Driver\");\n        } catch (Exception e) {\n            log.warn(\"Failed to load JDBC driver com.mysql.cj.jdbc.Driver \", e);\n        }\n        DorisSourceConfig dorisSourceConfig = DorisSourceConfig.of(context.getOptions());\n        List<DorisTableConfig> dorisTableConfigList = dorisSourceConfig.getTableConfigList();\n        Map<TablePath, DorisSourceTable> dorisSourceTables = new HashMap<>();\n\n        DorisCatalogFactory dorisCatalogFactory = new DorisCatalogFactory();\n        try (DorisCatalog catalog =\n                (DorisCatalog) dorisCatalogFactory.createCatalog(\"doris\", context.getOptions())) {\n            catalog.open();\n            for (DorisTableConfig dorisTableConfig : dorisTableConfigList) {\n                CatalogTable table;\n                TablePath tablePath = TablePath.of(dorisTableConfig.getTableIdentifier());\n                String readFields = dorisTableConfig.getReadField();\n                try {\n                    List<String> readFiledList = null;\n                    if (StringUtils.isNotBlank(readFields)) {\n                        readFiledList =\n                                Arrays.stream(readFields.split(\",\"))","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/source/DorisSourceFactory.java#L69-L105","documentation":"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.","triggerScenarios":"Calling createSource (when a Doris source table is instantiated during job graph construction) with the MySQL Connector/J jar absent from the runtime classpath.","commonSituations":"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.","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."],"exampleFix":"// before\nsh bin/install-plugin.sh --connectors connector-doris   # driver not bundled\n// after\ncp mysql-connector-java-8.0.28.jar $SEATUNNEL_HOME/lib/ && sh bin/seatunnel-cluster.sh -d","handlingStrategy":"validation","validationCode":"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\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["jdbc","classpath","mysql","source","doris"],"backgroundTag":"class-not-found","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}