{"record":{"id":"85249672054ef843","repo":"pagehelper-org/Mybatis-PageHelper","slug":"make-sure-that-the-autodialect-implementation-clas","errorCode":null,"errorMessage":"Make sure that the AutoDialect implementation class (${autoDialectClassStr}) for the autoDialectClass configuration exists!","messagePattern":"Make sure that the AutoDialect implementation class \\((.+?)\\) for the autoDialectClass configuration exists!","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/github/pagehelper/page/PageAutoDialect.java","lineNumber":285,"sourceCode":"\n    /**\n     * 初始化自定义 AutoDialect\n     *\n     * @param properties\n     */\n    private void initAutoDialectClass(Properties properties) {\n        String autoDialectClassStr = properties.getProperty(\"autoDialectClass\");\n        if (StringUtil.isNotEmpty(autoDialectClassStr)) {\n            try {\n                Class<? extends AutoDialect> autoDialectClass;\n                if (autoDialectMap.containsKey(autoDialectClassStr)) {\n                    autoDialectClass = autoDialectMap.get(autoDialectClassStr);\n                } else {\n                    autoDialectClass = (Class<AutoDialect>) Class.forName(autoDialectClassStr);\n                }\n                this.autoDialectDelegate = ClassUtil.newInstance(autoDialectClass, properties);\n            } catch (ClassNotFoundException e) {\n                throw new IllegalArgumentException(\"Make sure that the AutoDialect implementation class (\"\n                        + autoDialectClassStr + \") for the autoDialectClass configuration exists!\", e);\n            } catch (Exception e) {\n                throw new RuntimeException(autoDialectClassStr + \"Class must provide a constructor without parameters\", e);\n            }\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(\";\");","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/pagehelper-org/Mybatis-PageHelper/blob/c692616c5bc95b41aa779b502f991825c8e5acbc/src/main/java/com/github/pagehelper/page/PageAutoDialect.java#L267-L303","documentation":"When the autoDialectClass property is set, PageAutoDialect.initAutoDialectClass resolves the class either from the built-in autoDialect map or via Class.forName. If the class name cannot be found, it throws an IllegalArgumentException telling you the AutoDialect implementation class does not exist.","triggerScenarios":"Configuring autoDialectClass=<name> where <name> is neither a registered alias key in autoDialectMap nor a loadable fully-qualified Class.forName name (typo, missing jar, wrong package).","commonSituations":"Using a custom AutoDialect without adding its jar to the deployment; misspelling a built-in alias; renaming/refactoring the custom class after upgrading PageHelper so the configured name no longer exists.","solutions":["Correct autoDialectClass to a built-in alias (e.g. 'DefaultAutoDialect') or the exact fully-qualified class name.","Add/fix the jar containing the custom AutoDialect implementation on the classpath.","Verify the class implements com.github.pagehelper.dialect.auto.AutoDialect.","Catch IllegalArgumentException at startup and log the configured value for diagnosis."],"exampleFix":"// before\nprops.setProperty(\"autoDialectClass\", \"com.myapp.MyAutoDialct\"); // typo\n// after\nprops.setProperty(\"autoDialectClass\", \"com.myapp.MyAutoDialect\");","handlingStrategy":"validation","validationCode":"String v = props.getProperty(\"autoDialectClass\");\nif (v != null) {\n    try { Class.forName(v); } catch (ClassNotFoundException e) {\n        throw new IllegalStateException(\"autoDialectClass not found: \" + v, e);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    pluginConfigurer.setProperties(props);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"AutoDialect\")) {\n        log.error(\"Bad autoDialectClass={}, falling back to DefaultAutoDialect\", props.getProperty(\"autoDialectClass\"), e);\n        props.setProperty(\"autoDialectClass\", \"DefaultAutoDialect\");\n        pluginConfigurer.setProperties(props);\n    } else { throw e; }\n}","preventionTips":["Use the built-in alias keys from autoDialectMap instead of FQCNs when possible.","Keep the custom AutoDialect class in the deployment artifact; verify with a Class.forName smoke test at startup.","Grep config files for the autoDialectClass value whenever renaming/refactoring the class.","Ensure the class implements the AutoDialect interface of your PageHelper version."],"tags":["auto-dialect","class-not-found","configuration","java"],"backgroundTag":"class-not-found","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"}