{"record":{"id":"3ccdf4e0f98175be","repo":"apache/shenyu","slug":"please-config-shenyu-client-http-props-port-in-xml-yml-3ccdf4","errorCode":null,"errorMessage":"please config ${shenyu.client.http.props.port} in xml/yml !","messagePattern":"please config (.+?) in xml/yml !","errorType":"exception","errorClass":"ShenyuException","httpStatus":null,"severity":"error","filePath":"shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/src/main/java/org/apache/shenyu/client/spring/websocket/init/SpringWebSocketClientEventListener.java","lineNumber":134,"sourceCode":"    }\n\n    @Override\n    protected URIRegisterDTO buildURIRegisterDTO(final ApplicationContext context,\n                                                 final Map<String, Object> beans,\n                                                 final String namespaceId) {\n        try {\n            return URIRegisterDTO.builder()\n                    .contextPath(getContextPath())\n                    .appName(getAppName())\n                    .protocol(protocol)\n                    .host(super.getHost())\n                    .port(Integer.valueOf(getPort()))\n                    .rpcType(RpcTypeEnum.WEB_SOCKET.getName())\n                    .eventType(EventType.REGISTER)\n                    .namespaceId(namespaceId)\n                    .build();\n        } catch (ShenyuException e) {\n            throw new ShenyuException(e.getMessage() + \"please config ${shenyu.client.http.props.port} in xml/yml !\");\n        }\n    }\n    \n    @Override\n    protected String getClientName() {\n        return RpcTypeEnum.WEB_SOCKET.getName();\n    }\n    \n    @Override\n    protected void handle(final String beanName, final Object bean) {\n        Class<?> clazz = getCorrectedClass(bean);\n        final ShenyuSpringWebSocketClient beanShenyuClient = AnnotatedElementUtils.findMergedAnnotation(clazz, getAnnotationType());\n        final String superPath = buildApiSuperPath(clazz, beanShenyuClient);\n        // Compatible with previous versions\n        if (Objects.nonNull(beanShenyuClient)) {\n            handleClass(clazz, bean, beanShenyuClient, superPath);\n            return;\n        }","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/src/main/java/org/apache/shenyu/client/spring/websocket/init/SpringWebSocketClientEventListener.java#L116-L152","documentation":"SpringWebSocketClientEventListener.buildURIRegisterDTO() computes the websocket URI from the configured port; if reading the port throws ShenyuException (blank/missing shenyu.client.websocket.props.port), the catch rethrows a ShenyuException appending a hint to configure that property in xml/yml. The message preserves the original cause text from getPort().","triggerScenarios":"buildURIRegisterDTO() is invoked (via getBeans during client startup) while the props map for the websocket client has no 'port' entry or it is not a parseable integer, causing getPort()/Integer.valueOf to fail.","commonSituations":"application.yml missing shenyu.client.websocket.props.port; port set to a non-numeric string; config block named incorrectly (e.g. http instead of websocket) so defaults resolve to blank.","solutions":["Add shenyu.client.websocket.props.port (the backend websocket service port, e.g. 8888) to application.yml or xml props.","Ensure the port value is numeric and readable — check the original message text prepended to the hint for the real cause.","Confirm the config is under shenyu.client.websocket (this listener extends the http client config but the hint text says http.props.port historically).","Restart after fixing; the check occurs when URI register DTOs are built at startup."],"exampleFix":"// before\nshenyu:\n  client:\n    websocket:\n      props:\n        contextPath: /websocket\n// after\nshenyu:\n  client:\n    websocket:\n      props:\n        contextPath: /websocket\n        port: 8888","handlingStrategy":"validation","validationCode":"String port = props.getProperty(\"port\");\nif (port == null || !port.matches(\"\\\\d+\")) {\n    throw new IllegalStateException(\"shenyu.client.websocket.props.port must be a number\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    URI dto = buildURIRegisterDTO(bean);\n} catch (ShenyuException e) {\n    LOG.error(\"Websocket client config invalid: {}\", e.getMessage());\n}","preventionTips":["Include port in the websocket client props block of every environment's config.","Use config validation (spring boot configuration metadata / @Validated) for shenyu.client.* props.","Read the full message: the original cause text is prepended before the config hint."],"tags":["config","websocket","startup","missing-property"],"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"}