{"record":{"id":"fb51102ea442d328","repo":"pagehelper-org/Mybatis-PageHelper","slug":"dialectalias-parameter-misconfigured-please-follow","errorCode":null,"errorMessage":"dialectAlias parameter misconfigured,Please follow alias1=xx.dialectClass; alias2=dialectClass2!","messagePattern":"dialectAlias parameter misconfigured,Please follow alias1=xx\\.dialectClass; alias2=dialectClass2!","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/github/pagehelper/page/PageAutoDialect.java","lineNumber":307,"sourceCode":"            }\n        } else {\n            this.autoDialectDelegate = new DataSourceNegotiationAutoDialect();\n        }\n    }\n\n    /**\n     * 初始化方言别名\n     *\n     * @param properties\n     */\n    private void initDialectAlias(Properties properties) {\n        String dialectAlias = properties.getProperty(\"dialectAlias\");\n        if (StringUtil.isNotEmpty(dialectAlias)) {\n            String[] alias = dialectAlias.split(\";\");\n            for (int i = 0; i < alias.length; i++) {\n                String[] kv = alias[i].split(\"=\");\n                if (kv.length != 2) {\n                    throw new IllegalArgumentException(\"dialectAlias parameter misconfigured,\" +\n                            \"Please follow alias1=xx.dialectClass; alias2=dialectClass2!\");\n                }\n                for (int j = 0; j < kv.length; j++) {\n                    try {\n                        //允许配置如 dm=oracle, 直接引用oracle实现\n                        if (dialectAliasMap.containsKey(kv[1])) {\n                            registerDialectAlias(kv[0], dialectAliasMap.get(kv[1]));\n                        } else {\n                            Class<? extends Dialect> diallectClass = (Class<? extends Dialect>) Class.forName(kv[1]);\n                            //允许覆盖已有的实现\n                            registerDialectAlias(kv[0], diallectClass);\n                        }\n                    } catch (ClassNotFoundException e) {\n                        throw new IllegalArgumentException(\"Make sure the Dialect implementation class configured by dialectAlias exists!\", e);\n                    }\n                }\n            }\n        }","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/pagehelper-org/Mybatis-PageHelper/blob/c692616c5bc95b41aa779b502f991825c8e5acbc/src/main/java/com/github/pagehelper/page/PageAutoDialect.java#L289-L325","documentation":"initDialectAlias parses the dialectAlias property, expected as semicolon-separated alias=class pairs. If any segment does not split into exactly two '='-separated parts, an IllegalArgumentException with the required format is thrown at interceptor initialization.","triggerScenarios":"Setting dialectAlias to a malformed value, e.g. missing '=' (\"oracle=com...;foo\"), extra '=' (\"oracle=com.x.Y=Z\"), trailing semicolon producing an empty segment, or whitespace/typo like 'oralce=com...' with a stray comma.","commonSituations":"Copy-pasting dialectAlias config from docs with mixed separators (comma instead of semicolon); leaving a trailing ';'; quoting the whole value so quotes become part of the tokens; case where kv.length != 2 because the class name itself contains '='.","solutions":["Format the value strictly as alias1=fqcn;alias2=fqcn with semicolons between pairs and exactly one '=' per pair.","Remove trailing semicolons and stray whitespace/quotes from the property value.","Verify in code before init: split on ';' then on '=' and assert each segment has length 2.","If you only need one database, drop dialectAlias and use helperDialect instead."],"exampleFix":"// before\ndialectAlias=oracle=com.github.pagehelper.dialect.helper.OracleDb;dm=oracle,\n// after (comma removed, one pair per alias)\ndialectAlias=oracle=com.github.pagehelper.dialect.helper.OracleDb;dm=oracle","handlingStrategy":"validation","validationCode":"String dialectAlias = props.getProperty(\"dialectAlias\");\nif (dialectAlias != null) {\n    for (String pair : dialectAlias.split(\";\")) {\n        if (pair.split(\"=\").length != 2 || pair.isEmpty()) {\n            throw new IllegalStateException(\"Bad dialectAlias segment: [\" + pair + \"]\");\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    pluginConfigurer.setProperties(props);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"dialectAlias parameter misconfigured\")) {\n        log.error(\"Invalid dialectAlias value: [{}]\", props.getProperty(\"dialectAlias\"), e);\n    }\n    throw e;\n}","preventionTips":["Keep the format exactly alias=fqcn pairs joined by ';' — one '=' per pair, no trailing semicolon.","Trim whitespace and avoid quoting the property value.","Centralize the dialectAlias string in one config constant and unit-test parsing it.","If aliasing to a built-in dialect (dm=oracle) verify the alias key exists in your PageHelper version."],"tags":["dialect-alias","configuration","parsing","invalid-format"],"backgroundTag":"invalid-argument-format","analyzedSha":"c692616c5bc95b41aa779b502f991825c8e5acbc","analyzedAt":"2026-09-08T03:50:49.192Z","contentChangedAt":"2026-09-08T03:50:49.192Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}