需求:共有三个服务,Consumer、Proxy、以及Provider。Provider向Proxy提供RPC接口,Proxy调用Provider的服务,拿到数据并经过处理后,向Consumer提供RPC服务。
前提条件:
经过测试,Consumer单独调用Proxy的RPC接口没有异常,Proxy单独调用Provider的RPC接口也没有异常,但是三个服务一起运行,想要从Consumer通过Proxy调用Provider出现以下错误。
问题一:
Caused by: com.alibaba.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer.
程序报出连接超时,并且会重试三次。然而从程序开始调用到结束只用了几个毫秒,就报出异常。
解决方式:设置Proxy服务的超时时间
<dubbo:service interface="com.envision.edpbaseservice.rpc.service.EdpBaseServiceRpcService" ref="edpBaseServiceRpcService" timeout="60000"/>
问题二:
根据以上描述修改后,出现了第二个错误
[DUBBO] Decode rpc result failed:
Caused by: com.alibaba.com.caucho.hessian.io.HessianProtocolException: 'com....EdpBaseServiceConfig
' could not be instantiated
参考Hessian反序列化问题,在EdpBaseServiceConfig中添加空的构造方法后,问题解决。