更改nacos端口,项目启动连接nacos报错。

Blade 未结 2 454
ume
ume 2024-01-26 15:00

一、该问题的重现步骤是什么?

  1.  更改nacos端口为48848,本地项目连接nacos,启动报错,导致启动失败

        

二、你期待的结果是什么?实际看到的又是什么?

        期待连接成功,实际只能连接nacos默认端口的8848,更改nacos端口就会报如上错误。

三、你正在使用的是什么产品,什么版本?在什么操作系统上?

  1. 数据大屏

  2. 版本:org.springblade
    Data-Server
    3.2.2
    pom

  3. windows本地启动

  4. nacos linux部署

四、请提供详细的错误堆栈信息,这很重要。

  1. org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is java.lang.reflect.UndeclaredThrowableException

  2. at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.3.31.jar:5.3.31]

  3. at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.31.jar:5.3.31]

  4. at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:357) ~[spring-context-5.3.31.jar:5.3.31]

  5. at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_391]

  6. at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:156) ~[spring-context-5.3.31.jar:5.3.31]

  7. at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:124) ~[spring-context-5.3.31.jar:5.3.31]

  8. at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:946) ~[spring-context-5.3.31.jar:5.3.31]

  9. at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:594) ~[spring-context-5.3.31.jar:5.3.31]

  10. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.18.jar:2.7.18]

  11. at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-2.7.18.jar:2.7.18]

  12. at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:409) ~[spring-boot-2.7.18.jar:2.7.18]

  13. at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.18.jar:2.7.18]

  14. at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164) [spring-boot-2.7.18.jar:2.7.18]

  15. at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:49) [blade-core-launch-3.7.1.jar:na]

  16. at org.springblade.modules.visual.VisualApplication.main(VisualApplication.java:40) [classes/:na]

  17. Caused by: java.lang.reflect.UndeclaredThrowableException: null

  18. at org.springframework.util.ReflectionUtils.rethrowRuntimeException(ReflectionUtils.java:147) ~[spring-core-5.3.31.jar:5.3.31]

  19. at com.alibaba.cloud.nacos.registry.NacosServiceRegistry.register(NacosServiceRegistry.java:83) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.5.0.jar:2021.0.5.0]

  20. at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.register(AbstractAutoServiceRegistration.java:232) ~[spring-cloud-commons-3.1.7.jar:3.1.7]

  21. at com.alibaba.cloud.nacos.registry.NacosAutoServiceRegistration.register(NacosAutoServiceRegistration.java:78) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.5.0.jar:2021.0.5.0]

  22. at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.start(AbstractAutoServiceRegistration.java:133) ~[spring-cloud-commons-3.1.7.jar:3.1.7]

  23. at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.bind(AbstractAutoServiceRegistration.java:98) ~[spring-cloud-commons-3.1.7.jar:3.1.7]

  24. at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.onApplicationEvent(AbstractAutoServiceRegistration.java:86) ~[spring-cloud-commons-3.1.7.jar:3.1.7]

  25. at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.onApplicationEvent(AbstractAutoServiceRegistration.java:47) ~[spring-cloud-commons-3.1.7.jar:3.1.7]

  26. at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:178) ~[spring-context-5.3.31.jar:5.3.31]

  27. at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:171) ~[spring-context-5.3.31.jar:5.3.31]

  28. at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:145) ~[spring-context-5.3.31.jar:5.3.31]

  29. at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:429) ~[spring-context-5.3.31.jar:5.3.31]

  30. at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:386) ~[spring-context-5.3.31.jar:5.3.31]

  31. at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:46) ~[spring-boot-2.7.18.jar:2.7.18]

  32. at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:179) ~[spring-context-5.3.31.jar:5.3.31]

  33. ... 14 common frames omitted

  34. Caused by: com.alibaba.nacos.api.exception.NacosException: Client not connected, current status:STARTING

  35. at com.alibaba.nacos.common.remote.client.RpcClient.request(RpcClient.java:639) ~[nacos-client-2.2.0.jar:na]

  36. at com.alibaba.nacos.common.remote.client.RpcClient.request(RpcClient.java:619) ~[nacos-client-2.2.0.jar:na]

  37. at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.requestToServer(NamingGrpcClientProxy.java:356) ~[nacos-client-2.2.0.jar:na]

  38. at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.doRegisterService(NamingGrpcClientProxy.java:209) ~[nacos-client-2.2.0.jar:na]

  39. at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.registerService(NamingGrpcClientProxy.java:123) ~[nacos-client-2.2.0.jar:na]

  40. at com.alibaba.nacos.client.naming.remote.NamingClientProxyDelegate.registerService(NamingClientProxyDelegate.java:98) ~[nacos-client-2.2.0.jar:na]

  41. at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:152) ~[nacos-client-2.2.0.jar:na]

  42. at com.alibaba.cloud.nacos.registry.NacosServiceRegistry.register(NacosServiceRegistry.java:75) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.5.0.jar:2021.0.5.0]

  43. ... 27 common frames omitted


  44. 2024-01-26 14:50:14.019  WARN 37252 --- [       Thread-2] c.a.n.common.http.HttpClientBeanHolder   : [HttpClientBeanHolder] Start destroying common HttpClient

  45. 2024-01-26 14:50:14.019  WARN 37252 --- [       Thread-9] c.a.nacos.common.notify.NotifyCenter     : [NotifyCenter] Start destroying Publisher

  46. 2024-01-26 14:50:14.019  WARN 37252 --- [       Thread-9] c.a.nacos.common.notify.NotifyCenter     : [NotifyCenter] Destruction of the end

  47. 2024-01-26 14:50:14.021  WARN 37252 --- [       Thread-2] c.a.n.common.http.HttpClientBeanHolder   : [HttpClientBeanHolder] Destruction of the end


  48. Process finished with exit code 1

五、若有更多详细信息,请在下面提供。

2条回答
  •  ume
    ume (楼主)
    2024-01-26 15:07

    nacos的这三个端口已经开放了。因为我别的项目可以正常连接nacos

    作者追问:2024-01-26 15:07

    blade-common内的Launcher类,配置nacos地址,同时把地址的端口改了

    回答: 2024-01-26 15:07

    public void launcher(SpringApplicationBuilder builderString appNameString profile) {
       Properties props = System.getProperties();
       PropsUtil.setProperty(props"spring.cloud.nacos.discovery.server-addr""192.168.1.xxx:48848");
       //PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.port", "48848");

       PropsUtil.setProperty(props"spring.cloud.nacos.config.server-addr""192.168.1.xxx:48848");
       //PropsUtil.setProperty(props, "spring.cloud.nacos.config.port", "48848");
       PropsUtil.setProperty(props"spring.cloud.nacos.discovery.namespace""30ff24ca-153a-44ba-a638-0311d0a0cb6f");
       PropsUtil.setProperty(props"spring.cloud.nacos.config.namespace""30ff24ca-153a-44ba-a638-0311d0a0cb6f");
       PropsUtil.setProperty(props"spring.cloud.nacos.username""nacos");
       PropsUtil.setProperty(props"spring.cloud.nacos.password""jeP&Sewn5CaP");
       PropsUtil.setProperty(props"spring.cloud.nacos.config..file-extension""yaml");
       PropsUtil.setProperty(props"spring.cloud.sentinel.transport.dashboard"LauncherConstant.sentinelAddr(profile));
       PropsUtil.setProperty(props"spring.zipkin.base-url"LauncherConstant.zipkinAddr(profile));
    }

    已经改过了呀



    作者追问:2024-01-26 15:07

    点进去仔细看PropsUtil的逻辑,如果配置存在则跳过。所以你要用props.set直接覆盖,另外请将你的账号邮箱改为授权qq邮箱,这样才可以进行商业版的提问

提交回复