**com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method findGoodsById in the service

原文链接:https://blog.csdn.net/HiFighting/article/details/103864728

遇到一个方法测试了好多次都报*com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method findGoodsById in the service com.qingcheng.service.goods.SpuService. Tried 3 times

这个错。也百度了很多,很多人都说是序列化或者IP的问题,但是实体类都实现了序列化,IP也没问题。

下面的报错第一部分加黑的地方报了重试三次,第二部分加黑的地方打印出来了请求开始和结束的时间是1000毫秒。dubbo默认的超时时间是一秒,重试三次。就是超时的问题。需要给消费者配置超时时间。

在这里插入图片描述

 

com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method findGoodsById in the service com.qingcheng.service.goods.SpuService. Tried 3 times of the providers [192.168.18.19:20881] (1/1) from the registry 127.0.0.1:2181 on the consumer 192.168.18.19 using the dubbo version 2.6.0. Last error is: Invoke remote method timeout. method: findGoodsById, provider: dubbo://192.168.18.19:20881/com.qingcheng.service.goods.SpuService?anyhost=true&application=manager&check=false&dubbo=2.6.0&generic=false&interface=com.qingcheng.service.goods.SpuService&methods=add,findList,findById,update,findPage,saveGoods,delete,findAll,findGoodsById&pid=17648®ister.ip=192.168.18.19&remote.timestamp=1578314761933&revision=1.0-SNAPSHOT&side=consumer×tamp=1578314944465, cause: Waiting server-side response timeout by scan timer. start time: 2020-01-06 20:49:20.800, end time: 2020-01-06 20:49:21.818, client elapsed: 1 ms, server elapsed: 1017 ms, timeout: 1000 ms, request: Request [id=2, version=2.0.0, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=findGoodsById, parameterTypes=[class java.lang.String], arguments=[10000001516600], attachments={path=com.qingcheng.service.goods.SpuService, interface=com.qingcheng.service.goods.SpuService, version=0.0.0}]], channel: /192.168.18.19:56529 -> /192.168.18.19:20881
at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:101)
at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:232)
at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:70)
at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:51)
at com.alibaba.dubbo.common.bytecode.proxy7.findGoodsById(proxy7.java)
at com.qingcheng.controller.goods.SpuController.findGoodsById(SpuController.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocolA b s t r a c t C o n n e c t i o n H a n d l e r . p r o c e s s ( A b s t r a c t P r o t o c o l . j a v a : 603 ) a t o r g . a p a c h e . t o m c a t . u t i l . n e t . J I o E n d p o i n t AbstractConnectionHandler.process(AbstractProtocol.java:603) at org.apache.tomcat.util.net.JIoEndpointAbstractConnectionHandler.process(AbstractProtocol.java:603)atorg.apache.tomcat.util.net.JIoEndpointSocketProcessor.run(JIoEndpoint.java:310)
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:748)
Caused by: com.alibaba.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer. start time: 2020-01-06 20:49:20.800, end time: 2020-01-06 20:49:21.818, client elapsed: 1 ms, server elapsed: 1017 ms, timeout: 1000 ms, request: Request [id=2, version=2.0.0, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=findGoodsById, parameterTypes=[class java.lang.String], arguments=[10000001516600], attachments={path=com.qingcheng.service.goods.SpuService, interface=com.qingcheng.service.goods.SpuService, version=0.0.0}]], channel: /192.168.18.19:56529 -> /192.168.18.19:20881
at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.returnFromResponse(DefaultFuture.java:216)
at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.get(DefaultFuture.java:137)
at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.get(DefaultFuture.java:111)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboInvoker.doInvoke(DubboInvoker.java:95)
at com.alibaba.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:142)
at com.alibaba.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:73)
at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:74)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:53)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:47)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:52)
at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:77)
… 45 more
调用了公共异常处理类
20:49:21,901 DEBUG RequestResponseBodyMethodProcessor:277 - Written [com.qingcheng.entity.Result@7b0e287c] as “application/json” using [com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter@1940f0c4]
20:49:21,901 DEBUG DispatcherServlet:1076 - Null ModelAndView returned to DispatcherServlet with name ‘springmvc’: assuming HandlerAdapter completed request handling
20:49:21,901 DEBUG DispatcherServlet:1000 - Successfully completed request
20:49:22,199 DEBUG DecodeHandler:58 - [DUBBO] Decode decodeable message com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcResult, dubbo version: 2.6.0, current host: 192.168.18.19
20:49:22,200 WARN DefaultFuture:99 - [DUBBO] The timeout response finally returned at 2020-01-06 20:49:22.199, response Response [id=2, version=null, status=20, event=false, error=null, result=RpcResult [result=com.qingcheng.pojo.goods.Goods@202b29e8, exception=null]], channel: /192.168.18.19:56529 -> /192.168.18.19:20881, dubbo version: 2.6.0, current host: 192.168.18.19
20:49:22,299 DEBUG PoolingHttpClientConnectionManager:408 - Closing expired connections
20:49:22,299 DEBUG PoolingHttpClientConnectionManager:401 - Closing connections idle longer than 60000 MILLISECONDS
20:49:26,690 DEBUG ClientCnxn:742 - Got ping response for sessionid: 0x100002ba06d0017 after 0ms
20:49:27,300 DEBUG PoolingHttpClientConnectionManager:408 - Closing expired connections

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

	<dubbo:consumer id="manager" default="true" check="false" timeout="5000" retries="3" />

</beans>


————————————————
版权声明:本文为CSDN博主「HiFighting」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值