![image](https://github.com/apache/dubbo/assets/9292748/47acd7f8-08c2-480c-a6ff-0cbce847fb56)

Step to reproduce:
- Configure `-Ddubbo.registry.address=xxx`
logger.error(INTERNAL_ERROR, "invalid specified " + port + "  port, error "+e.getMessage(),
                    "", "Failed to find any valid protocol, will use random port to export  service.",e);
            }
        }
        if (this.port == null) {
            this.port = -1;
        }
        return getThis();
    }
    private ProtocolConfig getProtocolConfig() {
        return applicationModel.getApplicationConfigManager().getProtocol(protocol).orElse(null);
    }
    public ServiceConfig<T> build(Consumer<ServiceConfig<T>> configConsumer){
        ProtocolConfig protocolConfig = new ProtocolConfig();
        protocolConfig.setName(this.protocol);
        protocolConfig.setPort(this.port);
        this.nullAssert();
        logger.info("Using " + this.protocol + " protocol to export "+interfaceClass.getName()+" service on port " + protocolConfig.getPort());
        applicationModel.getApplicationConfigManager().getProtocol(this.protocol)
            .ifPresent(protocolConfig::mergeProtocol);
        ApplicationConfig applicationConfig = getApplicationConfig();
        ServiceConfig<T> serviceConfig = new ServiceConfig<>();
        serviceConfig.setScopeModel(applicationModel.getInternalModule());
        serviceConfig.setApplication(applicationConfig);
        RegistryConfig registryConfig = new RegistryConfig("N/A");
        registryConfig.setId(this.registryId);
        registryConfig.setScopeModel(this.applicationModel);
        serviceConfig.setRegistry(registryConfig);
        serviceConfig.setRegister(false);
        serviceConfig.setProtocol(protocolConfig);