{"record":{"id":"1d35aeebb33881c4","repo":"alibaba/canal","slug":"hbasemapping-database","errorCode":null,"errorMessage":"hbaseMapping.database","messagePattern":"hbaseMapping\\.database","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/config/MappingConfig.java","lineNumber":71,"sourceCode":"    public void setDestination(String destination) {\n        this.destination = destination;\n    }\n\n    public HbaseMapping getHbaseMapping() {\n        return hbaseMapping;\n    }\n\n    public void setHbaseMapping(HbaseMapping hbaseMapping) {\n        this.hbaseMapping = hbaseMapping;\n    }\n\n    public AdapterMapping getMapping() {\n        return hbaseMapping;\n    }\n\n    public void validate() {\n        if (hbaseMapping.database == null || hbaseMapping.database.isEmpty()) {\n            throw new NullPointerException(\"hbaseMapping.database\");\n        }\n        if (hbaseMapping.table == null || hbaseMapping.table.isEmpty()) {\n            throw new NullPointerException(\"hbaseMapping.table\");\n        }\n        if (hbaseMapping.hbaseTable == null || hbaseMapping.hbaseTable.isEmpty()) {\n            throw new NullPointerException(\"hbaseMapping.hbaseTable\");\n        }\n        if (hbaseMapping.mode == null) {\n            throw new NullPointerException(\"hbaseMapping.mode\");\n        }\n        if (hbaseMapping.rowKey != null && hbaseMapping.rowKeyColumn != null) {\n            throw new RuntimeException(\"已配置了复合主键作为RowKey，无需再指定RowKey列\");\n        }\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) return true;","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/config/MappingConfig.java#L53-L89","documentation":"MappingConfig.validate() requires HbaseMapping.database to be a non-null, non-empty string (the source MySQL/database or schema name). A null or empty database fails validation with this NullPointerException.","triggerScenarios":"Loading an HBase mapping YAML that omits 'hbaseMapping.database' or sets it to an empty string; config.validate() is called by MappingConfigLoader.load() during adapter startup.","commonSituations":"Newly authored or copy-pasted HBase mapping YAML missing the database line; YAML indentation error causing database to be parsed as null.","solutions":["Add 'database: <your_source_db_name>' under hbaseMapping in the mapping YAML.","Verify YAML indentation (database must be nested under hbaseMapping, two-space indent).","Validate the YAML with a linter before deploying.","Check that the database value is not quoted-empty ('')."],"exampleFix":"# before\nhbaseMapping:\n  table: t_user\n  hbaseTable: user\n\n# after\nhbaseMapping:\n  database: mydb\n  table: t_user\n  hbaseTable: user","handlingStrategy":"validation","validationCode":"// Validate before adapter startup\nMappingConfig cfg = YamlUtils.ymlToObj(null, content, MappingConfig.class, null, env);\nif (cfg.getHbaseMapping() == null\n        || cfg.getHbaseMapping().getDatabase() == null\n        || cfg.getHbaseMapping().getDatabase().isEmpty()) {\n    throw new IllegalArgumentException(\"hbaseMapping.database is required\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    config.validate();\n} catch (NullPointerException e) {\n    if (\"hbaseMapping.database\".equals(e.getMessage())) {\n        logger.error(\"Add 'database: <db>' under hbaseMapping in the YAML\");\n    }\n    throw e;\n}","preventionTips":["Always include database/table/hbaseTable/mode in every HBase mapping YAML.","Use a YAML schema/linter in CI.","Keep a known-good mapping template and copy from it."],"tags":["hbase-adapter","config","validation","yaml"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}