一、该问题的重现步骤是什么?
更改nacos端口为48848,本地项目连接nacos,启动报错,导致启动失败
二、你期待的结果是什么?实际看到的又是什么?
期待连接成功,实际只能连接nacos默认端口的8848,更改nacos端口就会报如上错误。
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
数据大屏
版本:<groupId>org.springblade</groupId>
<artifactId>Data-Server</artifactId>
<version>3.2.2</version>
<packaging>pom</packaging>
windows本地启动
nacos linux部署
四、请提供详细的错误堆栈信息,这很重要。
org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is java.lang.reflect.UndeclaredThrowableException
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:357) ~[spring-context-5.3.31.jar:5.3.31]
at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_391]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:156) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:124) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:946) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:594) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.18.jar:2.7.18]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-2.7.18.jar:2.7.18]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:409) ~[spring-boot-2.7.18.jar:2.7.18]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.18.jar:2.7.18]
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164) [spring-boot-2.7.18.jar:2.7.18]
at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:49) [blade-core-launch-3.7.1.jar:na]
at org.springblade.modules.visual.VisualApplication.main(VisualApplication.java:40) [classes/:na]
Caused by: java.lang.reflect.UndeclaredThrowableException: null
at org.springframework.util.ReflectionUtils.rethrowRuntimeException(ReflectionUtils.java:147) ~[spring-core-5.3.31.jar:5.3.31]
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]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.register(AbstractAutoServiceRegistration.java:232) ~[spring-cloud-commons-3.1.7.jar:3.1.7]
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]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.start(AbstractAutoServiceRegistration.java:133) ~[spring-cloud-commons-3.1.7.jar:3.1.7]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.bind(AbstractAutoServiceRegistration.java:98) ~[spring-cloud-commons-3.1.7.jar:3.1.7]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.onApplicationEvent(AbstractAutoServiceRegistration.java:86) ~[spring-cloud-commons-3.1.7.jar:3.1.7]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.onApplicationEvent(AbstractAutoServiceRegistration.java:47) ~[spring-cloud-commons-3.1.7.jar:3.1.7]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:178) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:171) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:145) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:429) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:386) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:46) ~[spring-boot-2.7.18.jar:2.7.18]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:179) ~[spring-context-5.3.31.jar:5.3.31]
... 14 common frames omitted
Caused by: com.alibaba.nacos.api.exception.NacosException: Client not connected, current status:STARTING
at com.alibaba.nacos.common.remote.client.RpcClient.request(RpcClient.java:639) ~[nacos-client-2.2.0.jar:na]
at com.alibaba.nacos.common.remote.client.RpcClient.request(RpcClient.java:619) ~[nacos-client-2.2.0.jar:na]
at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.requestToServer(NamingGrpcClientProxy.java:356) ~[nacos-client-2.2.0.jar:na]
at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.doRegisterService(NamingGrpcClientProxy.java:209) ~[nacos-client-2.2.0.jar:na]
at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.registerService(NamingGrpcClientProxy.java:123) ~[nacos-client-2.2.0.jar:na]
at com.alibaba.nacos.client.naming.remote.NamingClientProxyDelegate.registerService(NamingClientProxyDelegate.java:98) ~[nacos-client-2.2.0.jar:na]
at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:152) ~[nacos-client-2.2.0.jar:na]
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]
... 27 common frames omitted
2024-01-26 14:50:14.019 WARN 37252 --- [ Thread-2] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Start destroying common HttpClient
2024-01-26 14:50:14.019 WARN 37252 --- [ Thread-9] c.a.nacos.common.notify.NotifyCenter : [NotifyCenter] Start destroying Publisher
2024-01-26 14:50:14.019 WARN 37252 --- [ Thread-9] c.a.nacos.common.notify.NotifyCenter : [NotifyCenter] Destruction of the end
2024-01-26 14:50:14.021 WARN 37252 --- [ Thread-2] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Destruction of the end
Process finished with exit code 1
五、若有更多详细信息,请在下面提供。
nacos默认需要开放这三个端口。
nacos的这三个端口已经开放了。因为我别的项目可以正常连接nacos
blade-common内的Launcher类,配置nacos地址,同时把地址的端口改了
public void launcher(SpringApplicationBuilder builder, String appName, String 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));
}
已经改过了呀
点进去仔细看PropsUtil的逻辑,如果配置存在则跳过。所以你要用props.set直接覆盖,另外请将你的账号邮箱改为授权qq邮箱,这样才可以进行商业版的提问
扫一扫访问 Blade技术社区 移动端