{"record":{"id":"8f1398b71f1f663e","repo":"dromara/Sa-Token","slug":"sa-token-alone-redisson-config-sa-token-alon","errorCode":null,"errorMessage":"请配置 sa-token.alone-redisson.config 或 sa-token.alone-redisson.file","messagePattern":"请配置 sa-token\\.alone-redisson\\.config 或 sa-token\\.alone-redisson\\.file","errorType":"validation","errorClass":"SaTokenException","httpStatus":null,"severity":"critical","filePath":"sa-token-plugin/sa-token-alone-redisson/src/main/java/cn/dev33/satoken/dao/alone/SaAloneRedissonRegister.java","lineNumber":83,"sourceCode":"\t\tif (aloneClient != null && !aloneClient.isShuttingDown()) {\n\t\t\taloneClient.shutdown();\n\t\t}\n\t}\n\n\t/**\n\t * 解析 Redisson 原生 yaml：优先 config，其次 file\n\t */\n\tpublic static Config buildConfig(SaAloneRedissonProperties properties) {\n\t\ttry {\n\t\t\tConfig config;\n\t\t\tif (StringUtils.hasText(properties.getConfig())) {\n\t\t\t\tconfig = Config.fromYAML(properties.getConfig());\n\t\t\t} else if (StringUtils.hasText(properties.getFile())) {\n\t\t\t\ttry (InputStream in = openFile(properties.getFile())) {\n\t\t\t\t\tconfig = Config.fromYAML(in);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new SaTokenException(\"请配置 sa-token.alone-redisson.config 或 sa-token.alone-redisson.file\");\n\t\t\t}\n\t\t\treturn config;\n\t\t} catch (SaTokenException e) {\n\t\t\tthrow e;\n\t\t} catch (Exception e) {\n\t\t\tthrow new SaTokenException(\"解析 sa-token.alone-redisson 配置失败\", e);\n\t\t}\n\t}\n\n\tprivate static InputStream openFile(String file) throws Exception {\n\t\tString path = file.trim();\n\t\tResource resource;\n\t\tif (path.startsWith(\"classpath:\")) {\n\t\t\tresource = new ClassPathResource(path.substring(\"classpath:\".length()));\n\t\t} else if (path.startsWith(\"file:\")) {\n\t\t\tresource = new FileSystemResource(path.substring(\"file:\".length()));\n\t\t} else {\n\t\t\tresource = new ClassPathResource(path);","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/dromara/Sa-Token/blob/ac2c7f6e94a78573cf0bcb932dd8b04e68fad189/sa-token-plugin/sa-token-alone-redisson/src/main/java/cn/dev33/satoken/dao/alone/SaAloneRedissonRegister.java#L65-L101","documentation":"SaTokenException thrown by SaAloneRedissonRegister.buildConfig when neither sa-token.alone-redisson.config (inline yaml string) nor sa-token.alone-redisson.file (file path) has a value. The register needs a Redisson-native Config to build the separate RedissonClient for alone-redis storage; with both blank it cannot construct one and fails fast. It is re-thrown as-is, distinct from the generic parse failure (error 117).","triggerScenarios":"Adding sa-token-alone-redisson dependency without any sa-token.alone-redisson.* properties in application.yml; providing an empty string or only whitespace (StringUtils.hasText fails) for both properties.","commonSituations":"Assuming the plugin defaults to the primary Redisson config; setting properties under the wrong prefix (e.g. sa-token.alone-redis instead of sa-token.alone-redisson).","solutions":["Add an inline config: sa-token.alone-redisson.config: |\\n  singleServerConfig:\\n    address: redis://127.0.0.1:6379 ...","Or point to a file: sa-token.alone-redisson.file: classpath:alone-redisson.yaml.","Check the exact property prefix is sa-token.alone-redisson (not alone-redis).","Ensure the value is non-blank after yaml parsing (no empty scalar)."],"exampleFix":"# before\nsa-token:\n  alone-redisson:\n    # nothing configured -> throws\n\n# after\nsa-token:\n  alone-redisson:\n    config: |\n      singleServerConfig:\n        address: \"redis://127.0.0.1:6381\"\n        database: 1\n      threads: 4\n      nettyThreads: 4","handlingStrategy":"validation","validationCode":"// before app context starts\nif (!StringUtils.hasText(props.getConfig()) && !StringUtils.hasText(props.getFile())) {\n    throw new IllegalStateException(\"set sa-token.alone-redisson.config or .file\");\n}","typeGuard":"boolean hasRedissonSource(SaAloneRedissonProperties p) { return StringUtils.hasText(p.getConfig()) || StringUtils.hasText(p.getFile()); }","tryCatchPattern":null,"preventionTips":["Add the alone-redisson block to application.yml in the same commit that adds the dependency.","Use the exact prefix sa-token.alone-redisson; a blank value counts as unset."],"tags":["alone-redisson","redisson","configuration","missing-config"],"backgroundTag":null,"analyzedSha":"ac2c7f6e94a78573cf0bcb932dd8b04e68fad189","analyzedAt":"2026-08-14T14:36:10.271Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}