今天项目中web调用service虽然成功,但报如下问题
Caused by: com.alibaba.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer. start time: 2018-11-13 10:14:45.824, end time: 2018-11-13 10:14:46.838, client elapsed: 42 ms, server elapsed: 972 ms, timeout: 1000 ms, request: Request [id=0, version=2.0.0, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=qureyNow, parameterTypes=[], arguments=[], attachments={path=com.taotao.service.TestService, interface=com.taotao.service.TestService, version=0.0.0}]], channel: /192.168.43.34:14864 -> /192.168.43.34:20880
查资料后发现是dubbo超时,查询了多次才成功。该问题可以配置dubbo超时时间来解决(配置service):
xml配置:
<dubbo:service timeout="4000" retries="0" interface="com.dingding.tms.bms.service.BillingZfbCodOrderService" ref="billingZfbCodOrderService" registry="globalRegistry"/>
注解配置:
@Service(timeout = 1200000) //用com.alibaba的依赖包