{"record":{"id":"c738d5dfee946f4d","repo":"apache/seatunnel","slug":"common-writer-operation-failed-c738d5","errorCode":"COMMON_WRITER_OPERATION_FAILED","errorMessage":"unable to open JDBC sink committer","messagePattern":"unable to open JDBC sink committer","errorType":"error_code","errorClass":"JdbcConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkCommitter.java","lineNumber":47,"sourceCode":"import org.apache.seatunnel.connectors.seatunnel.jdbc.state.XidInfo;\n\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class JdbcSinkCommitter implements SinkCommitter<XidInfo> {\n    private final XaFacade xaFacade;\n    private final XaGroupOps xaGroupOps;\n    private final JdbcConnectionConfig jdbcConnectionConfig;\n\n    public JdbcSinkCommitter(JdbcSinkConfig jdbcSinkConfig) throws IOException {\n        this.jdbcConnectionConfig = jdbcSinkConfig.getJdbcConnectionConfig();\n        this.xaFacade = XaFacade.fromJdbcConnectionOptions(jdbcConnectionConfig);\n        this.xaGroupOps = new XaGroupOpsImpl(xaFacade);\n        try {\n            xaFacade.open();\n        } catch (Exception e) {\n            throw new JdbcConnectorException(\n                    CommonErrorCodeDeprecated.WRITER_OPERATION_FAILED,\n                    \"unable to open JDBC sink committer\",\n                    e);\n        }\n    }\n\n    @Override\n    public List<XidInfo> commit(List<XidInfo> committables) {\n        return xaGroupOps\n                .commit(\n                        new ArrayList<>(committables),\n                        false,\n                        jdbcConnectionConfig.getMaxCommitAttempts())\n                .getForRetry();\n    }\n\n    @Override\n    public void abort(List<XidInfo> commitInfos) {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkCommitter.java#L29-L65","documentation":"JdbcSinkCommitter's constructor opens an XA facade (XaFacade.fromJdbcConnectionOptions + xaFacade.open()) to manage exactly-once XA transactions; if opening the XA resource fails, it wraps the failure in WRITER_OPERATION_FAILED with message 'unable to open JDBC sink committer'. This means the committer could not establish a JDBC/XA connection to the database.","triggerScenarios":"Constructing JdbcSinkCommitter during sink commit phase when the underlying connection cannot be opened: bad JDBC URL, unreachable host/port, wrong credentials, driver missing, or the database not supporting the requested XA datasource.","commonSituations":"Database restarted or network partitioned between write and commit phases; expired/rotated DB credentials; misconfigured URL in jdbc connection options; driver jar not present in the plugin directory when the committer is instantiated.","solutions":["Read the wrapped cause 'e' in the logs — it names the actual failure (connection refused, auth failed, unknown driver)","Verify network connectivity and credentials from the SeaTunnel worker node to the database","Confirm the JDBC driver jar is installed under connectors/ and the url/driver options are correct","If the DB was temporarily down, simply retry the job once connectivity is restored"],"exampleFix":"// before\nurl = \"jdbc:mysql://localhost:3306/db\"\n// after\nurl = \"jdbc:mysql://db-host.internal:3306/db?useServerPrepStmts=true&connectTimeout=5000\"","handlingStrategy":"retry","validationCode":"try (Connection c = DriverManager.getConnection(jdbcUrl, user, pass)) {\n  // connectivity + credentials check before submitting the job\n  c.isValid(5);\n}","typeGuard":null,"tryCatchPattern":"try {\n  xaFacade.open();\n} catch (JdbcConnectorException e) {\n  logger.error(\"failed to open committer, cause: {}\", e.getCause(), e);\n  // retry with backoff or surface the root cause to the operator\n}","preventionTips":["Validate JDBC URL, credentials and driver availability before job submission","Monitor database availability between write and commit phases","Keep the JDBC driver jar updated in the plugin directory","Use connectTimeout/socketTimeout URL parameters to fail fast"],"tags":["jdbc","xa","connection","exactly-once"],"backgroundTag":"connection-refused","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}