{"record":{"id":"6d59c2497af8aa93","repo":"apache/seatunnel","slug":"failed-to-load-jdbc-driver-org-postgresql-driver","errorCode":null,"errorMessage":"Failed to load JDBC driver org.postgresql.Driver","messagePattern":"Failed to load JDBC driver org\\.postgresql\\.Driver","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-opengauss/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/opengauss/OpengaussIncrementalSourceFactory.java","lineNumber":100,"sourceCode":"                        JdbcSourceOptions.EXACTLY_ONCE)\n                .build();\n    }\n\n    @Override\n    public Class<? extends SeaTunnelSource> getSourceClass() {\n        return org.apache.seatunnel.connectors.seatunnel.cdc.postgres.source\n                .PostgresIncrementalSource.class;\n    }\n\n    @Override\n    public <T, SplitT extends SourceSplit, StateT extends Serializable>\n            TableSource<T, SplitT, StateT> createSource(TableSourceFactoryContext context) {\n        return () -> {\n            // Load the JDBC driver in to DriverManager\n            try {\n                Class.forName(\"org.postgresql.Driver\");\n            } catch (Exception e) {\n                log.warn(\"Failed to load JDBC driver org.postgresql.Driver\", e);\n            }\n            List<CatalogTable> catalogTables =\n                    CatalogTableUtil.getCatalogTables(\n                            \"Postgres\", context.getOptions(), context.getClassLoader());\n            Optional<List<JdbcSourceTableConfig>> tableConfigs =\n                    context.getOptions().getOptional(JdbcSourceOptions.TABLE_NAMES_CONFIG);\n            if (tableConfigs.isPresent()) {\n                catalogTables =\n                        CatalogTableUtils.mergeCatalogTableConfig(\n                                catalogTables, tableConfigs.get(), s -> TablePath.of(s, true));\n            }\n            return (SeaTunnelSource<T, SplitT, StateT>)\n                    new org.apache.seatunnel.connectors.seatunnel.cdc.postgres.source\n                            .PostgresIncrementalSource<>(context.getOptions(), catalogTables);\n        };\n    }\n}\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-opengauss/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/opengauss/OpengaussIncrementalSourceFactory.java#L82-L118","documentation":"OpengaussIncrementalSourceFactory.createSource tries Class.forName(\"org.postgresql.Driver\") inside the deferred createSource lambda so the JDBC DriverManager can find the Postgres driver for catalog/table discovery. Failure is only warned: execution continues, but subsequent JDBC-based catalog loading may fail later if the driver is truly absent.","triggerScenarios":"The classpath passed to the job lacks the postgresql JDBC driver jar, so Class.forName(\"org.postgresql.Driver\") throws ClassNotFoundException during createSource.","commonSituations":"openGauss CDC job deployed without the postgresql driver jar in $SEATUNNEL_HOME/lib or connector fat jar; driver excluded by shading; wrong connector installation (install-plugin.sh not run).","solutions":["Copy the PostgreSQL JDBC driver jar into $SEATUNNEL_HOME/lib (or the connector's lib dir) and restart the job.","Ensure the driver jar version is compatible with the target server (e.g. postgresql-42.x).","If the driver is shaded into another jar, verify no relocation broke the org.postgresql.Driver class name.","Run sh bin/install-plugin.sh to install connector dependencies if connectors were never installed."],"exampleFix":"// before\njob runs without postgresql driver -> ClassNotFoundException\n// after\ncp postgresql-42.7.3.jar $SEATUNNEL_HOME/lib/\n# then resubmit the job","handlingStrategy":"validation","validationCode":"try { Class.forName(\"org.postgresql.Driver\"); } catch (ClassNotFoundException e) { throw new IllegalStateException(\"postgresql JDBC jar missing from classpath\"); }","typeGuard":null,"tryCatchPattern":"try { factory.create(ctx); } catch (Throwable t) { if (rootCauseIsClassNotFound(t)) log.error(\"Add postgresql-x.jar to $SEATUNNEL_HOME/lib\"); throw t; }","preventionTips":["Ship the postgresql JDBC jar with the job or in lib/.","Run install-plugin.sh after installing SeaTunnel.","Pin and test driver versions in CI."],"tags":["java","jdbc","classpath","opengauss-cdc"],"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-23T08:17:48.524Z"}