alibaba/canal · critical · RuntimeException

No rdb adapter found for config key: {key}

Error message

No rdb adapter found for config key: {key}

What it means

Thrown by RdbAdapter.init() after loading and key-filtering all rdb mapping yml files. If none match this adapter's key, rdbMapping is empty and the adapter aborts before creating the DruidDataSource. The thrown key is configuration.getKey() declared under canalAdapters in application.yml.

Source

Thrown at client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/RdbAdapter.java:86

     * @param configuration 外部适配器配置信息
     */
    @Override
    public void init(OuterAdapterConfig configuration, Properties envProperties) {
        this.envProperties = envProperties;
        this.configuration = configuration;
      
        // 从jdbc url获取db类型
        Map<String, String> properties = configuration.getProperties();
        String dbType = JdbcUtils.getDbType(properties.get("jdbc.url"), null);
        // 当.yml文件编码格式存在问题,此处rdb yml文件构建 可能会抛出异常
        Map<String, MappingConfig> rdbMappingTmp = ConfigLoader.load(envProperties);
        // 过滤不匹配的key的配置
        rdbMappingTmp.forEach((key, config) -> {
            addConfig(key, config);
        });

        if (rdbMapping.isEmpty()) {
            throw new RuntimeException("No rdb adapter found for config key: " + configuration.getKey());
        }

        // 初始化连接池
        dataSource = new DruidDataSource();
        dataSource.setDriverClassName(properties.get("jdbc.driverClassName"));
        dataSource.setUrl(properties.get("jdbc.url"));
        dataSource.setUsername(properties.get("jdbc.username"));
        dataSource.setPassword(properties.get("jdbc.password"));
        dataSource.setInitialSize(1);
        dataSource.setMinIdle(1);
        dataSource.setMaxActive(30);
        dataSource.setMaxWait(60000);
        dataSource.setTimeBetweenEvictionRunsMillis(60000);
        dataSource.setMinEvictableIdleTimeMillis(300000);
        dataSource.setUseUnfairLock(true);
        dataSource.setDbType(dbType);

        // List<String> array = new ArrayList<>();

View on GitHub (pinned to 87be50e876)

Solutions

  1. Set 'outerAdapterKey:' in every rdb/*.yml to exactly the 'key:' declared for that rdb adapter in application.yml.
  2. Confirm rdb mapping yml files are in the correct config directory and are valid YAML.
  3. Check logs for the rdb config mapping keyset and null-parse skips.

Example fix

# application.yml
  - name: rdb
    key: mysql1
# rdb/my_table.yml
outerAdapterKey: mysql1
Defensive patterns

Strategy: validation

Validate before calling

String adapterKey = configuration.getKey();
boolean anyMatch = ConfigLoader.load(envProperties).values().stream()
    .anyMatch(c -> c.getOuterAdapterKey() != null
        && c.getOuterAdapterKey().equalsIgnoreCase(adapterKey));
if (!anyMatch) {
    throw new IllegalStateException(
        "No rdb mapping yml has outerAdapterKey=" + adapterKey);
}

Prevention

When it happens

Trigger: RdbAdapter.init() runs; every MappingConfig fails match() (outerAdapterKey non-null and != configuration.getKey(), or null with non-matching auto-generated prefix), or ConfigLoader.load() returned an empty map.

Common situations: The 'outerAdapterKey:' in an rdb/*.yml (e.g. 'mysql1') does not equal the 'key:' of the rdb adapter in application.yml. Rdb mapping files are missing or unparseable.

Related errors


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