开发者社区 > 云原生 > 微服务 > 正文

在Nacos中,这有可能是什么原因呢?

在Nacos中,这有可能是什么原因呢?1. 表象:nacos 客户端连不上服务端(拿不到配置内容)

  1. 看日志 $HOME/logs/nacos/remote.log 提示 9848 端口无法连接。
  2. 在客户端 telnet 服务端 9848 端口是通的(实际上客户端和服务段在同一台主机上)。
  3. nacos 是通过 docker 方式气动的,一开始映射了 8848,9848 端口出来,连不上,后面干脆指定了 --network=host 客户端也连不上。灵异甚至诡异的一个情况是:我通过 SSH 的端口转发功能把服务器的 8848, 9848 端口转发到本地,然后本地用相同的命令启动相同的 jar 包,是可以读取到 nacos 配置的。我在服务器用 SSH 的端口转发功能把 8848, 9848 端口转发到 3333, 4333,启动 jar 包,也是报错连接不上 4333。
    客户端报错:
    Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    2024-08-19 14:42:36 [main] ERROR org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter -

APPLICATION FAILED TO START


Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class

Action:

Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (the profiles test are currently active).

2024-08-19 14:42:36 [Thread-11] WARN com.alibaba.nacos.common.http.HttpClientBeanHolder -[HttpClientBeanHolder] Start destroying common HttpClient
2024-08-19 14:42:36 [Thread-11] WARN com.alibaba.nacos.common.http.HttpClientBeanHolder -[HttpClientBeanHolder] Destruction of the end
2024-08-19 14:42:36 [Thread-28] WARN com.alibaba.nacos.common.notify.NotifyCenter -[NotifyCenter] Start destroying Publisher

2024-08-19 14:42:36 [Thread-28] WARN com.alibaba.nacos.common.notify.NotifyCenter -[NotifyCenter] Destruction of the end

$HOME/logs/nacos/remote.log:
2024-08-19 14:41:52.732 INFO [main :c.a.n.c.r.client] [RpcClientFactory] create a new rpc client of 63b64116-f778-4cee-b22f-0d427f07f3cc_config-0
2024-08-19 14:41:52.755 INFO [main :c.a.n.c.r.client] [63b64116-f778-4cee-b22f-0d427f07f3cc_config-0] Register server push request handler:com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient$$Lambda$359/1489092624
2024-08-19 14:41:52.755 INFO [main :c.a.n.c.r.client] [63b64116-f778-4cee-b22f-0d427f07f3cc_config-0] Register server push request handler:com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient$$Lambda$360/192881625
2024-08-19 14:41:52.756 INFO [main :c.a.n.c.r.client] [63b64116-f778-4cee-b22f-0d427f07f3cc_config-0] Registry connection listener to current client:com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient$1
2024-08-19 14:41:52.756 INFO [main :c.a.n.c.r.client] [63b64116-f778-4cee-b22f-0d427f07f3cc_config-0] RpcClient init, ServerListFactory = com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient$2
2024-08-19 14:41:52.765 INFO [main :c.a.n.c.r.client] [63b64116-f778-4cee-b22f-0d427f07f3cc_config-0] Try to connect to server on start up, server: {serverIp = 'localhost', server main port = 3333}
2024-08-19 14:41:52.791 INFO [main :c.a.n.c.r.c.g.GrpcClient] grpc client connection server:localhost ip,serverPort:4333,grpcTslConfig:{"sslProvider":"","enableTls":false,"mutualAuthEnable":false,"trustAll":false}
2024-08-19 14:41:56.223 ERROR [main :c.a.n.c.r.c.g.GrpcClient] Server check fail, please check server localhost ,port 4333 is available , error ={}
java.util.concurrent.TimeoutException: Waited 3000 milliseconds (plus 407320 nanoseconds delay) for com.alibaba.nacos.shaded.io.grpc.stub.ClientCalls$GrpcFuture@52aa2946[status=PENDING, info=[GrpcFuture{clientCall=PendingCall{realCall=ClientCallImpl{method=MethodDescriptor{fullMethodName=Request/request, type=UNARY, idempotent=false, safe=false, sampledToLocalTracing=true, requestMarshaller=com.alibaba.nacos.shaded.io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller@4de5031f, responseMarshaller=com.alibaba.nacos.shaded.io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller@67e2d983, schemaDescriptor=com.alibaba.nacos.api.grpc.auto.RequestGrpc$RequestMethodDescriptorSupplier@5d47c63f}}}}]]
at com.alibaba.nacos.shaded.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:508) ~[nacos-client-2.2.3.jar!/:na]
at com.alibaba.nacos.common.remote.client.grpc.GrpcClient.serverCheck(GrpcClient.java:218) [nacos-client-2.2.3.jar!/:na]
at com.alibaba.nacos.common.remote.client.grpc.GrpcClient.connectToServer(GrpcClient.java:329) [nacos-client-2.2.3.jar!/:na]
at com.alibaba.nacos.common.remote.client.RpcClient.start(RpcClient.java:363) [nacos-client-2.2.3.jar!/:na]
at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.ensureRpcClient(ClientWorker.java:891) [nacos-client-2.2.3.jar!/:na]
at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.getOneRunningClient(ClientWorker.java:1038) [nacos-client-2.2.3.jar!/:na]
at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.queryConfig(ClientWorker.java:946) [nacos-client-2.2.3.jar!/:na]
at com.alibaba.nacos.client.config.impl.ClientWorker.getServerConfig(ClientWorker.java:403) [nacos-client-2.2.3.jar!/:na]
at com.alibaba.nacos.client.config.NacosConfigService.getConfigInner(NacosConfigService.java:184) [nacos-client-2.2.3.jar!/:na]
at com.alibaba.nacos.client.config.NacosConfigService.getConfig(NacosConfigService.java:96) [nacos-client-2.2.3.jar!/:na]
at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.loadNacosData(NacosPropertySourceBuilder.java:85) [spring-cloud-starter-alibaba-nacos-config-2021.0.5.0.jar!/:2021.0.5.0]
at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.build(NacosPropertySourceBuilder.java:73) [spring-cloud-starter-alibaba-nacos-config-2021.0.5.0.jar!/:2021.0.5.0]
at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosPropertySource(NacosPropertySourceLocator.java:199) [spring-cloud-starter-alibaba-nacos-config-2021.0.5.0.jar!/:2021.0.5.0]
at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosDataIfPresent(NacosPropertySourceLocator.java:186) [spring-cloud-starter-alibaba-nacos-config-2021.0.5.0.jar!/:2021.0.5.0]
at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosConfiguration(NacosPropertySourceLocator.java:158) [spring-cloud-starter-alibaba-nacos-config-2021.0.5.0.jar!/:2021.0.5.0]
at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadSharedConfiguration(NacosPropertySourceLocator.java:116) [spring-cloud-starter-alibaba-nacos-config-2021.0.5.0.jar!/:2021.0.5.0]
at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.locate(NacosPropertySourceLocator.java:101) [spring-cloud-starter-alibaba-nacos-config-2021.0.5.0.jar!/:2021.0.5.0]
at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:51) [spring-cloud-context-3.1.6.jar!/:3.1.6]
at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:47) [spring-cloud-context-3.1.6.jar!/:3.1.6]
at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:95) [spring-cloud-context-3.1.6.jar!/:3.1.6]
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:604) [spring-boot-2.7.12.jar!/:2.7.12]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:373) [spring-boot-2.7.12.jar!/:2.7.12]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306) [spring-boot-2.7.12.jar!/:2.7.12]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) [spring-boot-2.7.12.jar!/:2.7.12]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) [spring-boot-2.7.12.jar!/:2.7.12]
at com.eshore.bim.Application.main(Application.java:21) [classes!/:0.5.0-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_272]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_272]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_272]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_272]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [bim-data.jar:0.5.0-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) [bim-data.jar:0.5.0-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [bim-data.jar:0.5.0-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) [bim-data.jar:0.5.0-SNAPSHOT]

展开
收起
我睡觉不困 2024-08-26 13:38:47 75 0
0 条回答
写回答
取消 提交回答

为微服务建设降本增效,为微服务落地保驾护航。

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载