{"record":{"id":"1d8778ad67e10ecc","repo":"apache/seatunnel","slug":"failed-to-load-jdbc-driver-1d8778","errorCode":null,"errorMessage":"Failed to load JDBC driver {}","messagePattern":"Failed to load JDBC driver (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/sink/StarRocksSink.java","lineNumber":70,"sourceCode":"    private final SinkConfig sinkConfig;\n    private final DataSaveMode dataSaveMode;\n    private final SchemaSaveMode schemaSaveMode;\n    private final CatalogTable catalogTable;\n    private final Map<String, String> tableOptions;\n\n    public StarRocksSink(\n            SinkConfig sinkConfig, CatalogTable catalogTable, Map<String, String> tableOptions) {\n        this.sinkConfig = sinkConfig;\n        this.tableSchema = catalogTable.getTableSchema();\n        this.catalogTable = catalogTable;\n        this.tableOptions = tableOptions;\n        this.dataSaveMode = sinkConfig.getDataSaveMode();\n        this.schemaSaveMode = sinkConfig.getSchemaSaveMode();\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    }\n\n    @Override\n    public String getPluginName() {\n        return StarRocksCatalogFactory.IDENTIFIER;\n    }\n\n    @Override\n    public StarRocksSinkWriter createWriter(SinkWriter.Context 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        TablePath sinkTablePath = catalogTable.getTablePath();\n        return new StarRocksSinkWriter(context, sinkConfig, tableSchema, sinkTablePath);","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/sink/StarRocksSink.java#L52-L88","documentation":"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'.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"try {\n  Class.forName(\"com.mysql.cj.jdbc.Driver\");\n} catch (ClassNotFoundException e) {\n  throw new IllegalStateException(\"mysql-connector-j 8.x jar missing from plugin classpath\", e);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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)"],"tags":["jdbc","mysql","driver","classpath","dependency"],"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"}