apache/seatunnel · error · SeaTunnelException
${e.getMessage()}
Error message
${e.getMessage()} What it means
Db2Utils.currentLsn calls connection.getMaxLsn() to fetch the database's largest log sequence number. On SQLException it wraps the DB2 error message in a SeaTunnelException, so the visible message is whatever DB2 reported (e.g. stored-procedure or connection failure).
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/utils/Db2Utils.java:278
return getLsnPosition(record.sourceOffset());
}
public static LsnOffset getLsnPosition(Map<String, ?> offset) {
Map<String, String> offsetStrMap = new HashMap<>();
for (Map.Entry<String, ?> entry : offset.entrySet()) {
offsetStrMap.put(
entry.getKey(), entry.getValue() == null ? null : entry.getValue().toString());
}
return LsnOffset.valueOf(offsetStrMap);
}
/** Fetch current largest log sequence number (LSN) of the database. */
public static LsnOffset currentLsn(Db2Connection connection) {
try {
Lsn commitLsn = connection.getMaxLsn();
return LsnOffset.valueOf(commitLsn.toString());
} catch (SQLException e) {
throw new SeaTunnelException(e.getMessage(), e);
}
}
/** Get split scan query for the given table. */
public static String buildSplitScanQuery(
TableId tableId, SeaTunnelRowType rowType, boolean isFirstSplit, boolean isLastSplit) {
return buildSplitQuery(tableId, rowType, isFirstSplit, isLastSplit, -1, true);
}
/** Get table split data PreparedStatement. */
public static PreparedStatement readTableSplitDataStatement(
JdbcConnection jdbc,
String sql,
boolean isFirstSplit,
boolean isLastSplit,
Object[] splitStart,
Object[] splitEnd,
SeaTunnelRowType splitKeyType,View on GitHub (pinned to cf67b549a7)
Solutions
- Start the DB2 ASN capture service (CALL ASNCDC.START)
- Grant the connector user privileges to read LSN / execute CDC procedures
- Check DB2 connectivity and re-run the job
- Inspect the wrapped cause message for the actual DB2 error code
Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure CDC capture service is up before the source starts call ASNCDC.START; -- and verify IBMSNAP_REGISTER has entries
Try / catch
try { LsnOffset lsn = Db2Utils.currentLsn(connection); } catch (SeaTunnelException e) { log.error("getMaxLsn failed, check capture service/privileges: {}", e.getMessage()); throw e; } Prevention
- Start ASN capture service before running the connector
- Grant the connector user authority to read LSN data
- Validate DB2 connectivity at job startup
When it happens
Trigger: getMaxLsn() (which invokes the ASNCDC.ASN_READ_LSN-style access) fails — invalid connection, DB2 CDC service not registered/started, or insufficient privileges to read LSN.
Common situations: ASNCDC capture service not started; user lacks authority to execute CDC procedures; network/connection dropped to DB2; database not enabled for CDC.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Error to discover tables:
- Error to check tables:
- Read the binlog offset error
- not supported create new Offset by filename and position.
- Snapshotting of table failed
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/90c2f45b6bfb5eab.
Report an issue: GitHub.