apache/seatunnel · warning
Failed to load JDBC driver org.postgresql.Driver
Error message
Failed to load JDBC driver org.postgresql.Driver
What it means
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.
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.
Example fix
// before job runs without postgresql driver -> ClassNotFoundException // after cp postgresql-42.7.3.jar $SEATUNNEL_HOME/lib/ # then resubmit the job
Defensive patterns
Strategy: validation
Validate before calling
try { Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException e) { throw new IllegalStateException("postgresql JDBC jar missing from classpath"); } Try / catch
try { factory.create(ctx); } catch (Throwable t) { if (rootCauseIsClassNotFound(t)) log.error("Add postgresql-x.jar to $SEATUNNEL_HOME/lib"); throw t; } Prevention
- 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.
When it happens
Trigger: The classpath passed to the job lacks the postgresql JDBC driver jar, so Class.forName("org.postgresql.Driver") throws ClassNotFoundException during createSource.
Common situations: 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).
Related errors
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/6d59c2497af8aa93.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-opengauss/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/opengauss/OpengaussIncrementalSourceFactory.java:100
JdbcSourceOptions.EXACTLY_ONCE)
.build();
}
@Override
public Class<? extends SeaTunnelSource> getSourceClass() {
return org.apache.seatunnel.connectors.seatunnel.cdc.postgres.source
.PostgresIncrementalSource.class;
}
@Override
public <T, SplitT extends SourceSplit, StateT extends Serializable>
TableSource<T, SplitT, StateT> createSource(TableSourceFactoryContext context) {
return () -> {
// Load the JDBC driver in to DriverManager
try {
Class.forName("org.postgresql.Driver");
} catch (Exception e) {
log.warn("Failed to load JDBC driver org.postgresql.Driver", e);
}
List<CatalogTable> catalogTables =
CatalogTableUtil.getCatalogTables(
"Postgres", context.getOptions(), context.getClassLoader());
Optional<List<JdbcSourceTableConfig>> tableConfigs =
context.getOptions().getOptional(JdbcSourceOptions.TABLE_NAMES_CONFIG);
if (tableConfigs.isPresent()) {
catalogTables =
CatalogTableUtils.mergeCatalogTableConfig(
catalogTables, tableConfigs.get(), s -> TablePath.of(s, true));
}
return (SeaTunnelSource<T, SplitT, StateT>)
new org.apache.seatunnel.connectors.seatunnel.cdc.postgres.source
.PostgresIncrementalSource<>(context.getOptions(), catalogTables);
};
}
}
View on GitHub (pinned to cf67b549a7)