apache/shenyu · critical · ShenyuException

please config in xml/yml !

Error message

please config ${shenyu.client.http.props.port} in xml/yml !

What it means

SpringMvcClientEventListener.buildURIRegisterDTO resolves the client's port via getPort(), which reads the configured shenyu.client.http.props.port. When that resolution throws ShenyuException (port missing/unparseable), the catch rethrows with an appended hint telling the user to configure the port in xml/yml.

Solutions

  1. Add port under shenyu.client.http.props in application.yml
  2. Ensure the port value is a plain integer string (no quotes/spaces issues)
  3. Check the nested exception message to see the original failure before the hint
  4. Compare against shenyu-examples springmvc configuration

Example fix

// before
shenyu:
  client:
    http:
      props:
        contextPath: /http
// after
shenyu:
  client:
    http:
      props:
        contextPath: /http
        port: 8189
Defensive patterns

Strategy: validation

Validate before calling

String port = shenyuClientConfig.getHttp().getProps().get("port");
if (port == null || !port.matches("\\d+")) {
    throw new IllegalStateException("shenyu.client.http.props.port must be set to a number");
}

Try / catch

try { listener.buildURIRegisterDTO(bean); }
catch (ShenyuException e) {
    log.error("client registration failed, check shenyu.client.http.props.port: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Registering HTTP/SpringMVC API metadata at startup when shenyu.client.http.props.port is absent from application.yml/xml, so Integer.valueOf(getPort()) throws and the message gets the config hint appended.

Common situations: Missing props block in yml; port typo'd or non-numeric; copying http client config without the port key; yaml indentation making port null.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12). Data as JSON: /api/errors/b6988db331378058. Report an issue: GitHub.

Appendix: source

Thrown at shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientEventListener.java:162

    }

    @Override
    protected URIRegisterDTO buildURIRegisterDTO(final ApplicationContext context,
                                                 final Map<String, Object> beans,
                                                 final String namespaceId) {
        try {
            return URIRegisterDTO.builder()
                    .contextPath(getContextPath())
                    .appName(getAppName())
                    .protocol(protocol)
                    .host(super.getHost())
                    .port(Integer.valueOf(getPort()))
                    .rpcType(RpcTypeEnum.HTTP.getName())
                    .eventType(EventType.REGISTER)
                    .namespaceId(namespaceId)
                    .build();
        } catch (ShenyuException e) {
            throw new ShenyuException(e.getMessage() + "please config ${shenyu.client.http.props.port} in xml/yml !");
        }
    }
    
    @Override
    protected String getClientName() {
        return RpcTypeEnum.HTTP.getName();
    }
    
    @Override
    protected void handle(final String beanName, final Object bean) {
        Class<?> clazz = getCorrectedClass(bean);
        final ShenyuSpringMvcClient beanShenyuClient = AnnotatedElementUtils.findMergedAnnotation(clazz, getAnnotationType());
        final List<String> superPaths = buildApiSuperPaths(clazz, beanShenyuClient);
        final Method[] methods = ReflectionUtils.getUniqueDeclaredMethods(clazz);
        for (String superPath : superPaths) {
            if (Objects.nonNull(beanShenyuClient) && superPath.contains("*")) {
                handleClass(clazz, bean, beanShenyuClient, superPath);
                continue;

View on GitHub (pinned to 567142e072)