alibaba/canal · error · NullPointerException

hbaseMapping.hbaseTable

Error message

hbaseMapping.hbaseTable

What it means

MappingConfig.validate() requires HbaseMapping.hbaseTable (the destination HBase table name) to be non-null and non-empty. A blank destination table fails validation.

Source

Thrown at client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/config/MappingConfig.java:77

    }

    public void setHbaseMapping(HbaseMapping hbaseMapping) {
        this.hbaseMapping = hbaseMapping;
    }

    public AdapterMapping getMapping() {
        return hbaseMapping;
    }

    public void validate() {
        if (hbaseMapping.database == null || hbaseMapping.database.isEmpty()) {
            throw new NullPointerException("hbaseMapping.database");
        }
        if (hbaseMapping.table == null || hbaseMapping.table.isEmpty()) {
            throw new NullPointerException("hbaseMapping.table");
        }
        if (hbaseMapping.hbaseTable == null || hbaseMapping.hbaseTable.isEmpty()) {
            throw new NullPointerException("hbaseMapping.hbaseTable");
        }
        if (hbaseMapping.mode == null) {
            throw new NullPointerException("hbaseMapping.mode");
        }
        if (hbaseMapping.rowKey != null && hbaseMapping.rowKeyColumn != null) {
            throw new RuntimeException("已配置了复合主键作为RowKey,无需再指定RowKey列");
        }
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MappingConfig config = (MappingConfig) o;

        return hbaseMapping != null ? hbaseMapping.equals(config.hbaseMapping) : config.hbaseMapping == null;
    }

View on GitHub (pinned to 87be50e876)

Solutions

  1. Set 'hbaseTable: <target_hbase_table>' under hbaseMapping.
  2. Ensure the HBase table exists (or set autoCreateTable:true) on the destination cluster.
  3. Verify YAML key spelling is exactly 'hbaseTable'.
  4. Lint the YAML.

Example fix

# before
hbaseMapping:
  database: mydb
  table: t_user

# after
hbaseMapping:
  database: mydb
  table: t_user
  hbaseTable: user
Defensive patterns

Strategy: validation

Validate before calling

MappingConfig cfg = ...;
if (cfg.getHbaseMapping() == null
        || cfg.getHbaseMapping().getHbaseTable() == null
        || cfg.getHbaseMapping().getHbaseTable().isEmpty()) {
    throw new IllegalArgumentException("hbaseMapping.hbaseTable is required");
}

Try / catch

try {
    config.validate();
} catch (NullPointerException e) {
    if ("hbaseMapping.hbaseTable".equals(e.getMessage())) {
        logger.error("Add 'hbaseTable: <target>' under hbaseMapping");
    }
    throw e;
}

Prevention

When it happens

Trigger: HBase mapping YAML missing 'hbaseMapping.hbaseTable' or setting it empty; validate() invoked at config load.

Common situations: Mapping YAML where the HBase target table name was deleted or never filled; typo such as 'hbaseTbl'.

Related errors


AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14). Data as JSON: /api/errors/e8b51402a137dd7c. Report an issue: GitHub.