{"record":{"id":"cd12f917f50e3dc2","repo":"apache/shenyu","slug":"please-config-the-registertype-and-serverlist","errorCode":null,"errorMessage":"please config the registerType and serverList","messagePattern":"please config the registerType and serverList","errorType":"validation","errorClass":"ShenyuException","httpStatus":null,"severity":"error","filePath":"shenyu-spring-boot-starter/shenyu-spring-boot-starter-registry/src/main/java/org/apache/shenyu/springboot/starter/registry/RegistryListener.java","lineNumber":57,"sourceCode":"    \n    private final String host;\n    \n    private final String appName;\n    \n    private final Properties props;\n    \n    private final ShenyuInstanceRegisterRepository repository;\n    \n    /**\n     * Instantiates a new Instance register listener.\n     *\n     * @param config the config\n     */\n    public RegistryListener(final RegisterConfig config) {\n        String registerType = config.getRegisterType();\n        String serverLists = config.getServerLists();\n        if (StringUtils.isBlank(registerType) || StringUtils.isBlank(serverLists)) {\n            throw new ShenyuException(\"please config the registerType and serverList\");\n        }\n        repository = ShenyuInstanceRegisterRepositoryFactory.newAndInitInstance(config);\n        this.props = config.getProps();\n        String name = props.getProperty(\"name\");\n        this.appName = StringUtils.isBlank(name) ? \"shenyu-gateway\" : name;\n        String host = props.getProperty(\"host\");\n        this.host = StringUtils.isBlank(host) ? IpUtils.getHost() : host;\n    }\n    \n    @Override\n    public void onApplicationEvent(final WebServerInitializedEvent event) {\n        if (!registered.compareAndSet(false, true)) {\n            return;\n        }\n        String configPort = props.getProperty(\"port\");\n        int port = StringUtils.isBlank(configPort) ? event.getWebServer().getPort() : Integer.parseInt(configPort);\n        InstanceEntity instanceEntity = buildInstanceRegisterDTO(port);\n        repository.persistInstance(instanceEntity);","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-spring-boot-starter/shenyu-spring-boot-starter-registry/src/main/java/org/apache/shenyu/springboot/starter/registry/RegistryListener.java#L39-L75","documentation":"The gateway-side register listener needs to know which registry type (zookeeper, etcd, nacos, ...) to use and the server list to connect to. If shenyu.register.register-type or shenyu.register.server-lists is blank, RegistryListener construction fails immediately with this ShenyuException.","triggerScenarios":"Enabling shenyu.register.enabled=true (or including the registry starter) without setting register-type and/or server-lists in configuration.","commonSituations":"Deploying the gateway with the cluster/registration starter but leaving the register block empty; copying only part of a sample config; overriding env vars that end up empty strings.","solutions":["Set shenyu.register.register-type (e.g. zookeeper, etcd, nacos) and shenyu.register.server-lists (comma-separated addresses)","Disable registration (shenyu.register.enabled=false) if this deployment should not register","Ensure the values are not overridden to empty by environment variables or profile configs"],"exampleFix":"# before\nshenyu:\n  register:\n    enabled: true\n# after\nshenyu:\n  register:\n    enabled: true\n    register-type: zookeeper\n    server-lists: 127.0.0.1:2181","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(config.getRegisterType()) || StringUtils.isBlank(config.getServerLists())) {\n    throw new IllegalArgumentException(\"shenyu.register.register-type and server-lists are required\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    new RegistryListener(registerConfig);\n} catch (ShenyuException e) {\n    if (e.getMessage().contains(\"registerType and serverList\")) {\n        log.error(\"Configure shenyu.register.register-type and shenyu.register.server-lists\");\n    } else throw e;\n}","preventionTips":["Ship a fully filled register block in every gateway profile","Guard against env-var overrides that yield empty strings","Only enable the registry starter when registration is intended"],"tags":["registry","configuration","gateway","startup"],"backgroundTag":"missing-required-config-field","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}