参考:SpringCloud搭建Nacos配置中心_springcloud nacos maven-CSDN博客
解决了pom.xml的依赖冲突后,在启动服务时,报错了,并且自动停止了。
2024-07-17 11:13:03.597 ERROR [com.alibaba.nacos.client.remote.worker] com.alibaba.nacos.common.remote.client.grpc.GrpcClient.connectToServer:338 : [b2b9c711-1168-4e91-a76b-17eeb81b36a4]Fail to connect to server!,error={}
java.util.concurrent.RejectedExecutionException: Task com.alibaba.nacos.shaded.io.grpc.internal.SerializingExecutor@22486ebd rejected from java.util.concurrent.ThreadPoolExecutor@220be130[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 6]
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
at com.alibaba.nacos.shaded.io.grpc.internal.SerializingExecutor.schedule(SerializingExecutor.java:93)
at com.alibaba.nacos.shaded.io.grpc.internal.SerializingExecutor.execute(SerializingExecutor.java:86)
at com.alibaba.nacos.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.closedInternal(ClientCallImpl.java:755)
at com.alibaba.nacos.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.closed(ClientCallImpl.java:705)
at com.alibaba.nacos.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.closed(ClientCallImpl.java:698)
at com.alibaba.nacos.shaded.io.grpc.internal.DelayedStream.cancel(DelayedStream.java:302)
at com.alibaba.nacos.shaded.io.grpc.internal.DelayedClientTransport$PendingStream.cancel(DelayedClientTransport.java:363)
at com.alibaba.nacos.shaded.io.grpc.internal.DelayedClientTransport.shutdownNow(DelayedClientTransport.java:241)
at com.alibaba.nacos.shaded.io.grpc.internal.ManagedChannelImpl$UncommittedRetriableStreamsRegistry.onShutdownNow(ManagedChannelImpl.java:1052)
at com.alibaba.nacos.shaded.io.grpc.internal.ManagedChannelImpl.shutdownNow(ManagedChannelImpl.java:774)
at com.alibaba.nacos.shaded.io.grpc.internal.ManagedChannelImpl.shutdownNow(ManagedChannelImpl.java:104)
at com.alibaba.nacos.shaded.io.grpc.internal.ForwardingManagedChannel.shutdownNow(ForwardingManagedChannel.java:52)
at com.alibaba.nacos.shaded.io.grpc.internal.ManagedChannelOrphanWrapper.shutdownNow(ManagedChannelOrphanWrapper.java:65)
at com.alibaba.nacos.common.remote.client.grpc.GrpcClient.shuntDownChannel(GrpcClient.java:178)
at com.alibaba.nacos.common.remote.client.grpc.GrpcClient.connectToServer(GrpcClient.java:309)
at com.alibaba.nacos.common.remote.client.RpcClient.reconnect(RpcClient.java:498)
at com.alibaba.nacos.common.remote.client.RpcClient.lambda$start$2(RpcClient.java:339)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
2024-07-17 11:13:03.597 INFO [main] com.alibaba.nacos.client.auth.ram.identify.CredentialService.free:100 : [null] CredentialService is freed
2024-07-17 11:13:03.597 INFO [main] com.alibaba.nacos.client.naming.shutdown:211 : com.alibaba.nacos.client.naming.remote.NamingClientProxyDelegate do shutdown stop
2024-07-17 11:13:03.600 INFO [main] com.baomidou.dynamic.datasource.DynamicRoutingDataSource.destroy:211 : dynamic-datasource start closing ....
2024-07-17 11:13:03.600 INFO [main] com.baomidou.dynamic.datasource.DynamicRoutingDataSource.destroy:215 : dynamic-datasource all closed success,bye
2024-07-17 11:13:03.702 INFO [com.alibaba.nacos.client.remote.worker] com.alibaba.nacos.common.remote.client.printIfInfoEnabled:60 : [b2b9c711-1168-4e91-a76b-17eeb81b36a4] Client is shutdown, stop reconnect to server
2024-07-17 11:13:03.702 INFO [main] org.apache.coyote.http11.Http11NioProtocol.log:173 : Pausing ProtocolHandler ["http-nio-8080"]
2024-07-17 11:13:03.702 INFO [main] org.apache.catalina.core.StandardService.log:173 : Stopping service [Tomcat]
2024-07-17 11:13:03.709 INFO [main] org.apache.coyote.http11.Http11NioProtocol.log:173 : Stopping ProtocolHandler ["http-nio-8080"]
2024-07-17 11:13:03.711 INFO [main] org.apache.coyote.http11.Http11NioProtocol.log:173 : Destroying ProtocolHandler ["http-nio-8080"]
2024-07-17 11:13:03.717 INFO [main] o.s.b.a.logging.ConditionEvaluationReportLoggingListener.logMessage:136 :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2024-07-17 11:13:03.734 ERROR [main] org.springframework.boot.SpringApplication.reportFailure:835 : Application run failed
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:181)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
at java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:745)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:420)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
at org.example.NacosTestApplication.main(NacosTestApplication.java:22)
Caused by: java.lang.reflect.UndeclaredThrowableException: null
at org.springframework.util.ReflectionUtils.rethrowRuntimeException(ReflectionUtils.java:147)
at com.alibaba.cloud.nacos.registry.NacosServiceRegistry.register(NacosServiceRegistry.java:83)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.register(AbstractAutoServiceRegistration.java:232)
at com.alibaba.cloud.nacos.registry.NacosAutoServiceRegistration.register(NacosAutoServiceRegistration.java:78)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.start(AbstractAutoServiceRegistration.java:133)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.bind(AbstractAutoServiceRegistration.java:98)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.onApplicationEvent(AbstractAutoServiceRegistration.java:86)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.onApplicationEvent(AbstractAutoServiceRegistration.java:47)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:46)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
... 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)
at com.alibaba.nacos.common.remote.client.RpcClient.request(RpcClient.java:619)
at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.requestToServer(NamingGrpcClientProxy.java:356)
at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.doRegisterService(NamingGrpcClientProxy.java:209)
at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.registerService(NamingGrpcClientProxy.java:123)
at com.alibaba.nacos.client.naming.remote.NamingClientProxyDelegate.registerService(NamingClientProxyDelegate.java:98)
at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:152)
at com.alibaba.cloud.nacos.registry.NacosServiceRegistry.register(NacosServiceRegistry.java:75)
... 27 common frames omitted
2024-07-17 11:13:03.735 WARN [Thread-6] com.alibaba.nacos.common.http.HttpClientBeanHolder.shutdown:102 : [HttpClientBeanHolder] Start destroying common HttpClient
2024-07-17 11:13:03.735 WARN [Thread-16] com.alibaba.nacos.common.notify.NotifyCenter.shutdown:136 : [NotifyCenter] Start destroying Publisher
2024-07-17 11:13:03.735 WARN [Thread-16] com.alibaba.nacos.common.notify.NotifyCenter.shutdown:153 : [NotifyCenter] Destruction of the end
Disconnected from the target VM, address: '127.0.0.1:51495', transport: 'socket'
Process finished with exit code 1