{"record":{"id":"904b919f865df485","repo":"apache/seatunnel","slug":"failed-to-load-jdbc-driver-904b91","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-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSink.java","lineNumber":100,"sourceCode":"\n    private final DataSaveMode dataSaveMode;\n\n    private final SchemaSaveMode schemaSaveMode;\n\n    private final CatalogTable catalogTable;\n\n    public JdbcSink(\n            ReadonlyConfig config,\n            JdbcSinkConfig jdbcSinkConfig,\n            JdbcDialect dialect,\n            SchemaSaveMode schemaSaveMode,\n            DataSaveMode dataSaveMode,\n            CatalogTable catalogTable) {\n        // Load the JDBC driver in to DriverManager\n        try {\n            Class.forName(jdbcSinkConfig.getJdbcConnectionConfig().getDriverName());\n        } catch (Exception e) {\n            log.warn(\n                    \"Failed to load JDBC driver {}\",\n                    jdbcSinkConfig.getJdbcConnectionConfig().getDriverName(),\n                    e);\n        }\n        this.config = config;\n        this.jdbcSinkConfig = jdbcSinkConfig;\n        this.dialect = dialect;\n        this.schemaSaveMode = schemaSaveMode;\n        this.dataSaveMode = dataSaveMode;\n        this.catalogTable = catalogTable;\n        this.tableSchema = catalogTable.getTableSchema();\n    }\n\n    @Override\n    public String getPluginName() {\n        return \"Jdbc\";\n    }\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSink.java#L82-L118","documentation":"JdbcSink's constructor attempts Class.forName(driverName) to register the JDBC driver with DriverManager and logs a WARN (not a throw) if the driver class cannot be loaded. This is a best-effort pre-check; failure typically means the driver jar is not on the classpath. The sink proceeds but connection attempts will later fail with 'No suitable driver'.","triggerScenarios":"Constructing JdbcSink with a driverName whose class is absent from the plugin classpath — missing driver jar in $SEATUNNEL_HOME/plugins/jdbc/lib or connectors classpath.","commonSituations":"Driver jar not downloaded via install-plugin.sh; wrong driver class name in url/driver config (e.g. com.mysql.jdbc.Driver vs com.mysql.cj.jdbc.Driver); running Zeta cluster where only worker nodes have the jar.","solutions":["Place the driver jar in $SEATUNNEL_HOME/plugins/jdbc/lib (or connector lib dir) on all nodes and restart the cluster","Correct the driver-name option in the JDBC sink config to the fully-qualified class shipped in the jar","Use a shaded driver if the default conflicts with other jars on the classpath","Verify the jar actually loads by checking startup logs or jar listing in the lib directory"],"exampleFix":"# before\nsink {\n  Jdbc {\n    driver_name = \"com.mysql.cj.jdbc.Driver\"  # jar missing\n  }\n}\n# after\ncp mysql-connector-j-8.x.jar $SEATUNNEL_HOME/plugins/jdbc/lib/\n# restart cluster; warn disappears","handlingStrategy":"validation","validationCode":"try {\n    Class.forName(\"com.mysql.cj.jdbc.Driver\");\n    System.out.println(\"driver OK\");\n} catch (ClassNotFoundException e) {\n    System.out.println(\"add driver jar to $SEATUNNEL_HOME/plugins/jdbc/lib\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    Class.forName(driverName);\n} catch (ClassNotFoundException e) {\n    throw new IllegalArgumentException(\"JDBC driver not on classpath: \" + driverName, e);\n}","preventionTips":["Run install-plugin.sh to provision JDBC driver jars","Keep driver jars in $SEATUNNEL_HOME/plugins/jdbc/lib on every node","Use the driver class name matching your driver version (mysql 8 = com.mysql.cj.jdbc.Driver)","Restart the cluster after adding jars"],"tags":["jdbc","driver","classpath","sink"],"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-14T05:17:10.506Z"}