{"record":{"id":"aafef818fcbab7d6","repo":"alibaba/canal","slug":"no-rdb-adapter-found-for-config-key-key","errorCode":null,"errorMessage":"No rdb adapter found for config key: {key}","messagePattern":"No rdb adapter found for config key: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/RdbAdapter.java","lineNumber":86,"sourceCode":"     * @param configuration 外部适配器配置信息\n     */\n    @Override\n    public void init(OuterAdapterConfig configuration, Properties envProperties) {\n        this.envProperties = envProperties;\n        this.configuration = configuration;\n      \n        // 从jdbc url获取db类型\n        Map<String, String> properties = configuration.getProperties();\n        String dbType = JdbcUtils.getDbType(properties.get(\"jdbc.url\"), null);\n        // 当.yml文件编码格式存在问题，此处rdb yml文件构建 可能会抛出异常\n        Map<String, MappingConfig> rdbMappingTmp = ConfigLoader.load(envProperties);\n        // 过滤不匹配的key的配置\n        rdbMappingTmp.forEach((key, config) -> {\n            addConfig(key, config);\n        });\n\n        if (rdbMapping.isEmpty()) {\n            throw new RuntimeException(\"No rdb adapter found for config key: \" + configuration.getKey());\n        }\n\n        // 初始化连接池\n        dataSource = new DruidDataSource();\n        dataSource.setDriverClassName(properties.get(\"jdbc.driverClassName\"));\n        dataSource.setUrl(properties.get(\"jdbc.url\"));\n        dataSource.setUsername(properties.get(\"jdbc.username\"));\n        dataSource.setPassword(properties.get(\"jdbc.password\"));\n        dataSource.setInitialSize(1);\n        dataSource.setMinIdle(1);\n        dataSource.setMaxActive(30);\n        dataSource.setMaxWait(60000);\n        dataSource.setTimeBetweenEvictionRunsMillis(60000);\n        dataSource.setMinEvictableIdleTimeMillis(300000);\n        dataSource.setUseUnfairLock(true);\n        dataSource.setDbType(dbType);\n\n        // List<String> array = new ArrayList<>();","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/RdbAdapter.java#L68-L104","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set 'outerAdapterKey:' in every rdb/*.yml to exactly the 'key:' declared for that rdb adapter in application.yml.","Confirm rdb mapping yml files are in the correct config directory and are valid YAML.","Check logs for the rdb config mapping keyset and null-parse skips."],"exampleFix":"# application.yml\n  - name: rdb\n    key: mysql1\n# rdb/my_table.yml\nouterAdapterKey: mysql1","handlingStrategy":"validation","validationCode":"String adapterKey = configuration.getKey();\nboolean anyMatch = ConfigLoader.load(envProperties).values().stream()\n    .anyMatch(c -> c.getOuterAdapterKey() != null\n        && c.getOuterAdapterKey().equalsIgnoreCase(adapterKey));\nif (!anyMatch) {\n    throw new IllegalStateException(\n        \"No rdb mapping yml has outerAdapterKey=\" + adapterKey);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the rdb adapter 'key:' and every rdb yml 'outerAdapterKey:' identical via a shared config source.","Add a CI check that loads all rdb yml files and asserts each adapter key has a matching config."],"tags":["rdb","config","adapter-init","canal","key-mismatch"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}