问题表现:HTTP Status 500 - Request processing failed; nested exception is com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method getBrandList in the service com.xxx.sellergoods.service.xxxService. Tried 3 times of the providers [192.168.204.1:20881] (1/1) from the registry 192.168.1.127:2181 on the consumer 192.168.204.1 using the dubbo version 2.8.4. Last error is: Invoke remote method timeout. method: getBrandList, provider: dubbo://192.168.204.1:20881/com.xxx.sellergoods.service.xxxService?anyhost=true&application=yizhigou-manager-web&check=false&dubbo=2.8.4&generic=false&interface=com.xxx.sellergoods.service.xxxService&methods=getBrandList&pid=335616&revision=1.0-SNAPSHOT&side=consumer×tamp=1596703619137, cause: Waiting server-side response timeout. start time: 2020-08-06 16:47:06.130, end time: 2020-08-06 16:47:07.132, client elapsed: 0 ms, server elapsed: 1002 ms, timeout: 1000 ms, request: Request [id=2, version=2.0.0, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=getBrandList, parameterTypes=[], arguments=[], attachments={path=com.yizhigou.sellergoods.service.BrandService, interface=com.xxx.sellergoods.service.xxxService, version=0.0.0}]], channel: /192.168.204.1:63194 -> /192.168.204.1:20881
意思就是说无法调用这个提供者的getList方法。尝试调用了三次,仍然失败。
问题排查:
1.首先确认提供者发接口发布到dubbo中
2。确认dao层的注入是否完成
解决方案:
1。没有序列化pojo类 在pojo类中实现序列化接口
在分布式环境下,当进行远程通信时,无论是何种类型的数据,都会以二进制的形式在网络上进行传送。序列化是一种将对象,以一连串的字节描述的过程,用于解决在对对象流进行读写时所引发的问题。
2.可能是由于网络延迟引起的问题,返回值还没返回。连接就关闭了。
在service中加了一个超时的声明标签:@Service(timeout = 50000)
3.可是数据库连接问题,使用的jar包不匹配
把mysql-connector-java-5.1.32换成mysql-connector-java-5.1.46
问题解决,很nice~~~~~~