alibaba/DataX · error · Adb4pgClientException

CONFIG_ERROR

CONFIG_ERROR

Error message

Check config exception: %s

What it means

Thrown by Adb4pgUtil.checkConfig when the AnalyticDB for PostgreSQL writer's job configuration is invalid. checkConfig runs convertConfiguration (which enforces required keys like username/password via getNecessaryValue) and constructs an Adb4pgClient from the derived DatabaseConfig; any failure in that chain is rethrown as Adb4pgClientException with code CONFIG_ERROR. The original cause's message is appended after 'Check config exception: '.

Source

Thrown at adbpgwriter/src/main/java/com/alibaba/datax/plugin/writer/adbpgwriter/util/Adb4pgUtil.java:39

import java.util.*;

import static com.alibaba.datax.plugin.rdbms.util.DBUtilErrorCode.COLUMN_SPLIT_ERROR;

/**
 * @author yuncheng
 */
public class Adb4pgUtil {

    private static final Logger LOG = LoggerFactory.getLogger(Adb4pgUtil.class);
    private static final DataBaseType DATABASE_TYPE = DataBaseType.PostgreSQL;
    public static void checkConfig(Configuration originalConfig) {
        try {

            DatabaseConfig databaseConfig = convertConfiguration(originalConfig);

            Adb4pgClient testConfigClient = new Adb4pgClient(databaseConfig);
        } catch (Exception e) {
            throw new Adb4pgClientException(Adb4pgClientException.CONFIG_ERROR, "Check config exception: " + e.getMessage(), null);
        }
    }

    public static DatabaseConfig convertConfiguration(Configuration originalConfig) {
        originalConfig.getNecessaryValue(Key.USERNAME, COLUMN_SPLIT_ERROR);
        originalConfig.getNecessaryValue(Key.PASSWORD, COLUMN_SPLIT_ERROR);


        String userName = originalConfig.getString(Key.USERNAME);
        String passWord = originalConfig.getString(Key.PASSWORD);
        String tableName = originalConfig.getString(Key.TABLE);
        String schemaName = originalConfig.getString(com.alibaba.datax.plugin.writer.adbpgwriter.util.Key.SCHEMA);
        String host = originalConfig.getString(com.alibaba.datax.plugin.writer.adbpgwriter.util.Key.HOST);
        String port = originalConfig.getString(com.alibaba.datax.plugin.writer.adbpgwriter.util.Key.PORT);
        String databseName = originalConfig.getString(com.alibaba.datax.plugin.writer.adbpgwriter.util.Key.DATABASE);

        List<String> columns = originalConfig.getList(Key.COLUMN, String.class);
        DatabaseConfig databaseConfig = new DatabaseConfig();

View on GitHub (pinned to 80ec23d5c5)

Solutions

  1. Open the job JSON and confirm the writer.parameter block contains non-empty username and password keys exactly as the plugin expects (Key.USERNAME / Key.PASSWORD).
  2. Verify remaining required fields (host, port, database, table, schema, column list) are present and correctly spelled in the same block.
  3. Run checkConfig in isolation with your Configuration object and print e.getMessage() to see which nested key/constraint failed.
  4. If the message still lacks detail, temporarily catch inside convertConfiguration's getNecessaryValue calls to identify the exact missing key name.

Example fix

// before (job json)
{"writer": {"name": "adbpgwriter", "parameter": {"username": "u"}}
// after
{"writer": {"name": "adbpgwriter", "parameter": {"username": "u", "password": "p", "host": "gp-xxxx.gpdb.rds.aliyuncs.com", "port": 3432, "database": "db", "table": ["t"], "schema": "public", "column": ["*"]}}
Defensive patterns

Strategy: try-catch

Validate before calling

boolean requiredKeysPresent(Configuration c) {
    for (String k : new String[]{"username", "password", "host", "port", "database", "table", "schema", "column"}) {
        if (c.getString(k) == null && c.getList(k) == null) return false;
    }
    return true;
}

Try / catch

try {
    Adb4pgUtil.checkConfig(originalConfig);
} catch (Adb4pgClientException e) {
    if (e.getCode() == Adb4pgClientException.CONFIG_ERROR) {
        throw new IllegalStateException("adbpgwriter config invalid: " + e.getMessage(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling checkConfig(originalConfig) when: username or password keys are missing (getNecessaryValue throws), required connection fields (host/port/database/table/schema) are absent or malformed so DatabaseConfig construction fails, or Adb4pgClient constructor rejects the config (e.g. blank host, unparseable port).

Common situations: A DataX job JSON for adbpgwriter with a typo'd key ('user' instead of 'username'), omitted jdbcUrl/username/password blocks, wrong nesting of the connection config, or extra whitespace/empty-string values that pass presence checks but fail client construction.

Related errors


AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14). Data as JSON: /api/errors/c78e784e7e6b52f7. Report an issue: GitHub.