{"record":{"id":"257273e9bcc5360a","repo":"dromara/Sa-Token","slug":"sa-token-redis-xxx-alone-redis","errorCode":null,"errorMessage":"未引入 sa-token-redis-xxx 相关插件，或引入的插件不在 Alone-Redis 支持范围内","messagePattern":"未引入 sa-token-redis-xxx 相关插件，或引入的插件不在 Alone-Redis 支持范围内","errorType":"exception","errorClass":"SaTokenException","httpStatus":null,"severity":"critical","filePath":"sa-token-plugin/sa-token-alone-redis-by-spring-boot4/src/main/java/cn/dev33/satoken/dao/alone/SaAloneRedisInject.java","lineNumber":212,"sourceCode":"\t\t\ttry {\n\t\t\t\tClass.forName(\"cn.dev33.satoken.dao.SaTokenDaoForRedisTemplateUseJdkSerializer\");\n\t\t\t\tSaTokenDaoForRedisTemplate dao = (SaTokenDaoForRedisTemplate) saTokenDao;\n\t\t\t\tdao.isInit = false;\n\t\t\t\tdao.init(factory);\n\t\t\t\treturn;\n\t\t\t} catch (ClassNotFoundException ignored) {\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tClass.forName(\"cn.dev33.satoken.dao.SaTokenDaoForRedisTemplate\");\n\t\t\t\tSaTokenDaoForRedisTemplate dao = (SaTokenDaoForRedisTemplate) saTokenDao;\n\t\t\t\tdao.isInit = false;\n\t\t\t\tdao.init(factory);\n\t\t\t\treturn;\n\t\t\t} catch (ClassNotFoundException ignored) {\n\t\t\t}\n\n\t\t\t// 至此，说明开发者一个 redis 插件也没引入，或者引入的 redis 插件不在 sa-token-alone-redis 的支持范围内\n\t\t\tthrow new SaTokenException(\"未引入 sa-token-redis-xxx 相关插件，或引入的插件不在 Alone-Redis 支持范围内\");\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\n\t/**\n\t * 骗过编辑器，增加配置文件代码提示\n\t * @return 配置对象\n\t */\n\t@ConfigurationProperties(prefix = ALONE_PREFIX)\n\tpublic DataRedisProperties getSaAloneRedisConfig() {\n\t\treturn new DataRedisProperties();\n\t}\n\n}\n","sourceCodeStart":194,"sourceCodeEnd":229,"githubUrl":"https://github.com/dromara/Sa-Token/blob/ac2c7f6e94a78573cf0bcb932dd8b04e68fad189/sa-token-plugin/sa-token-alone-redis-by-spring-boot4/src/main/java/cn/dev33/satoken/dao/alone/SaAloneRedisInject.java#L194-L229","documentation":"SaTokenException thrown by SaAloneRedisInject (spring-boot4 variant) during re-injection of the alone-redis connection factory into the active SaTokenDao: it probes for known dao classes (SaTokenDaoForRedisTemplate and siblings) via Class.forName, and if none is present on the classpath it concludes no supported sa-token-redis plugin was introduced. Each probe failure is silently swallowed (ClassNotFoundException ignored) before this terminal throw.","triggerScenarios":"Adding sa-token-alone-redis-by-spring-boot4 to the project without also adding a redis dao plugin such as sa-token-redis-template (or adding an out-of-support one, e.g. a Jackson dao variant whose class name is not probed). Note the surrounding try/catch prints the stack trace via e.printStackTrace() and may mask this exception in logs.","commonSituations":"Following the alone-redis docs but skipping the prerequisite '集成 sa-token-redis 插件' step; mixing plugin versions where the dao class was renamed/moved between majors.","solutions":["Add a supported redis dao dependency, e.g. sa-token-redis-template (or the packaged dao matching your stack) alongside sa-token-alone-redis-by-spring-boot4.","Align versions: use the same sa-token version for all sa-token-* artifacts so class names match the ones probed.","Scan the startup log for the printed stack trace to confirm this throw (and not an earlier swallowed CNFE) is the real blocker.","If you intentionally use a custom dao, it is not 'alone-injectable' — connect it to the separate redis manually instead of relying on this auto-injection."],"exampleFix":"# before (pom)\n<dependency>\n  <groupId>cn.dev33</groupId>\n  <artifactId>sa-token-alone-redis-by-spring-boot4</artifactId>\n</dependency>\n\n# after\n<dependency>\n  <groupId>cn.dev33</groupId>\n  <artifactId>sa-token-alone-redis-by-spring-boot4</artifactId>\n</dependency>\n<dependency>\n  <groupId>cn.dev33</groupId>\n  <artifactId>sa-token-redis-template</artifactId>\n  <version>${sa-token.version}</version>\n</dependency>","handlingStrategy":"validation","validationCode":"// in a CI/startup smoke test\nClass.forName(\"cn.dev33.satoken.dao.SaTokenDaoForRedisTemplate\"); // throws if dao plugin missing\n// plus assert all sa-token-* artifacts share one version","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin a single sa-token.version property across every sa-token-* dependency in the BOM/pom.","Add a startup assertion that the expected dao class is loadable before the app accepts traffic."],"tags":["alone-redis","dependency-missing","sa-token-dao","spring-boot4"],"backgroundTag":null,"analyzedSha":"ac2c7f6e94a78573cf0bcb932dd8b04e68fad189","analyzedAt":"2026-08-14T14:36:10.271Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}