java.util.concurrent.TimeoutException: Waited 3000 milliseconds (plus 2 milliseconds, 351400 nanosec

使用若依的微服务项目时,在本地启动项目时报错如下:

java.util.concurrent.TimeoutException: Waited 3000 milliseconds (plus 2 milliseconds, 351400 nanoseconds delay) for com.alibaba.nacos.shaded.io.grpc.stub.ClientCalls$GrpcFuture@1c6e0a08[status=PENDING, info=[GrpcFuture{clientCall={delegate={delegate=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@4351171a, responseMarshaller=com.alibaba.nacos.shaded.io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller@3c2772d1, schemaDescriptor=com.alibaba.nacos.api.grpc.auto.RequestGrpc$RequestMethodDescriptorSupplier@37d00a23}}}}}]]
    at com.alibaba.nacos.shaded.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:508)
    at com.alibaba.nacos.common.remote.client.grpc.GrpcClient.serverCheck(GrpcClient.java:148)
    at com.alibaba.nacos.common.remote.client.grpc.GrpcClient.connectToServer(GrpcClient.java:264)
    at com.alibaba.nacos.common.remote.client.RpcClient.start(RpcClient.java:390)
    at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.ensureRpcClient(ClientWorker.java:885)
    at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.getOneRunningClient(ClientWorker.java:1044)
    at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.queryConfig(ClientWorker.java:940)
    at com.alibaba.nacos.client.config.impl.ClientWorker.getServerConfig(ClientWorker.java:397)
    at com.alibaba.nacos.client.config.NacosConfigService.getConfigInner(NacosConfigService.java:166)
    at com.alibaba.nacos.client.config.NacosConfigService.getConfig(NacosConfigService.java:94)
    at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.loadNacosData(NacosPropertySourceBuilder.java:85)
    at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.build(NacosPropertySourceBuilder.java:73)
    at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosPropertySource(NacosPropertySourceLocator.java:199)
    at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosDataIfPresent(NacosPropertySourceLocator.java:186)
    at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosConfiguration(NacosPropertySourceLocator.java:158)
    at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadSharedConfiguration(NacosPropertySourceLocator.java:116)
    at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.locate(NacosPropertySourceLocator.java:101)
    at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:51)
    at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:47)
    at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:95)
    at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:618)
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:385)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
    at com.ruoyi.gateway.RuoYiGatewayApplication.main(RuoYiGatewayApplication.java:17)

但是服务可以正常使用,为了解决这个报错,在网上搜索一番,发现都不是我这个问题,特此记录一下:

若依的微服务默认导的nacos依赖版本是

<alibaba.nacos.version>2.0.4</alibaba.nacos.version>

而我本地使用的是2.0.3,将版本修改为本地nacos版本后解决了问题。

  • 9
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
java.util.concurrent.TimeoutException是一个在Java中常见的异常,表示在等待某个操作完成时超时了。它通常发生在执行异步操作时,等待结果的过程中超过了预定的时间。在你提供的引用中,这个异常可能是由于异步请求没有在预定的时间内完成导致的。 在引用中提到了timeout方法应该正确处理ResultFuture,否则异步请求就没有真正结束。如果没有对ResultFuture进行处理,可能会导致超时异常的发生。在这个例子中,timeout方法通过调用resultFuture.complete或completeExceptionally来处理ResultFuture,以确保异步请求的结束,并返回适当的结果。 在引用中提到了Springbootadmin在检查消费者的健康接口时,如果返回结果超时,会判定该消费者为离线状态。这可能是由于邮箱校验等服务的延迟导致的。为了解决这个问题,可以禁用健康接口的邮件校验,通过在消费者的配置中添加management.health.mail.enabled: false来实现。 另外,在引用中提到,监控健康的超时时间默认是5秒,可以通过在Springbootadmin所在项目的配置文件中增加spring.boot.admin.monitor.default-timeout来修改超时时间,以适应实际需求。 综上所述,java.util.concurrent.TimeoutException可能是由于异步请求超时或健康接口检查超时引起的。可以通过正确处理ResultFuture、禁用邮件校验或调整超时时间等方式来解决这个问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Flink 异步IO时 java.util.concurrent.TimeoutException: Async function call has timed out.](https://blog.csdn.net/qq_39261894/article/details/108873808)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [SpringBootAdmin 超时踩坑必备](https://blog.csdn.net/u014685642/article/details/128201165)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值