{"record":{"id":"6fa77b69b396a0b2","repo":"apache/seatunnel","slug":"failed-to-load-jdbc-driver-com-mysql-cj-jdbc-drive-6fa77b","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/sink/DorisSink.java","lineNumber":78,"sourceCode":"        implements SeaTunnelSink<SeaTunnelRow, DorisSinkState, DorisCommitInfo, DorisCommitInfo>,\n                SupportSaveMode,\n                SupportMultiTableSink,\n                SupportSchemaEvolutionSink {\n\n    private final DorisSinkConfig dorisSinkConfig;\n    private final ReadonlyConfig config;\n    private final CatalogTable catalogTable;\n    private String jobId;\n\n    public DorisSink(ReadonlyConfig config, CatalogTable catalogTable) {\n        this.config = config;\n        this.catalogTable = catalogTable;\n        this.dorisSinkConfig = DorisSinkConfig.of(config);\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 \"Doris\";\n    }\n\n    @Override\n    public void setJobContext(JobContext jobContext) {\n        this.jobId = jobContext.getJobId();\n    }\n\n    @Override\n    public DorisSinkWriter createWriter(SinkWriter.Context context) throws IOException {\n        // Load the JDBC driver in to DriverManager\n        try {\n            Class.forName(\"com.mysql.cj.jdbc.Driver\");","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/sink/DorisSink.java#L60-L96","documentation":"WARN logged in the DorisSink constructor when Class.forName(\"com.mysql.cj.jdbc.Driver\") throws, meaning the MySQL Connector/J JDBC driver is not on the classpath. Doris uses the MySQL protocol for JDBC-based operations (e.g. schema change via JDBC/QueryConnection), so a missing driver can break later catalog operations. The sink constructor still completes because the exception is swallowed.","triggerScenarios":"Instantiating DorisSink (new DorisSink(...)) on a runtime where the mysql-connector-java / mysql-connector-j jar is absent from the plugin classpath — typical when the connector was installed without its dependencies or with an incompatible driver version.","commonSituations":"Plugin dir missing the MySQL JDBC jar; SeaTunnel Zeta installed via minimal distribution without install-plugin.sh; shaded/older connector versions where the driver class moved; classloader isolation preventing driver visibility.","solutions":["Run sh bin/install-plugin.sh to download the MySQL JDBC driver into the connectors directory","Manually place mysql-connector-java-8.x.jar (providing com.mysql.cj.jdbc.Driver) in $SEATUNNEL_HOME/connectors and/or lib","Verify the jar is on the job's classpath for the engine being used (Zeta/Flink/Spark)","If using MySQL Connector/J 5.x, upgrade to 8.x since com.mysql.cj.jdbc.Driver only exists in 8.x","Check driver visibility under the plugin classloader and avoid conflicts with shaded jars"],"exampleFix":"// before\nclasspath=\"...;lib/*\"\n// after\nclasspath=\"...;lib/*;connectors/mysql-connector-java-8.0.27.jar\"","handlingStrategy":"fallback","validationCode":"try { Class.forName(\"com.mysql.cj.jdbc.Driver\"); }\ncatch (ClassNotFoundException e) { throw new IllegalStateException(\"Install mysql-connector-j 8.x\"); }","typeGuard":"boolean mysqlDriverPresent() {\n    try { Class.forName(\"com.mysql.cj.jdbc.Driver\"); return true; }\n    catch (ClassNotFoundException e) { return false; }\n}","tryCatchPattern":"try { Class.forName(\"com.mysql.cj.jdbc.Driver\"); }\ncatch (ClassNotFoundException e) { throw new IllegalStateException(\"Driver missing\", e); }","preventionTips":["Run install-plugin.sh after SeaTunnel install","Keep mysql-connector-j 8.x jar in connectors/lib on all nodes","Avoid Connector/J 5.x (wrong class name)"],"tags":["jdbc","mysql","doris","classpath","dependency"],"backgroundTag":"missing-dependency","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"}