bubbo调用Failed to invoke remote method异常解决

bubbo调用服务异常:

com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote method: getPlanFlowInfo, provider: dubbo://10.20.30.164:21331/com.ys.mqpms.api.IMqPmsApi?application=ysportal-server&default.check=false&default.timeout=300000&dubbo=2.5.3&interface=com.ys.mqpms.api.IMqPmsApi&methods=.....................

at com.alibaba.dubbo.rpc.protocol.dubbo.DubboInvoker.doInvoke(DubboInvoker.java:101)

at com.alibaba.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:144)

........................................................

at java.lang.Thread.run(Thread.java:745)

Caused by: com.alibaba.dubbo.remoting.RemotingException: message can not send, because channel is closed . url:dubbo://10.20.30.164:21331/com.ys.mqpms.api.IMqPmsApi?application=ysportal-server&codec=dubbo&default.check=false&default.timeout=300000&dubbo=2.5.3&heartbeat=60000&interface=com.ys.mqpms.api.IMqPmsApi&methods=......................................

at com.alibaba.dubbo.remoting.transport.AbstractClient.send(AbstractClient.java:268)

at com.alibaba.dubbo.remoting.transport.AbstractPeer.send(AbstractPeer.java:51)

at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeChannel.request(HeaderExchangeChannel.java:112)

at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeClient.request(HeaderExchangeClient.java:91)

at com.alibaba.dubbo.rpc.protocol.dubbo.ReferenceCountExchangeClient.request(ReferenceCountExchangeClient.java:81)

at com.alibaba.dubbo.rpc.protocol.dubbo.DubboInvoker.doInvoke(DubboInvoker.java:96)

... 74 more

原因分析

message can not send, because channel is closed   远程方法调用失败,提示通道被关闭,无法发送信息

打开dubbo的管理页面:出现此异常是,对应下图服务应该是不存在的.(下图是服务已经提供出去后正确的显示)

bubbo调用Failed to invoke remote method异常解决

1. 检查服务提供的配置文件是否正确,配置文件是否加载

dubbo_provider.xml  提供服务的文件

<dubbo:service interface="com.ys.xxxx.xxxx.xxxx" ref="xxxxImpl"   version="1.0" />

bean.xml  加载 dubbo_provider.xml  配置文件

<import resource="classpath*:/dubbo_provider.xml" />

2.检查客户端、服务端的超时配置;如果超时时间没有设置,设置为一个较长时间,就可以了

<dubbo:consumer check="false" timeout="300000" />
    <dubbo:provider timeout="300000" />

3.检查你调用服务所在机器ip地址与你调用端配置的ip地址端口是否一致,如下红色url地址

dubbo_customer.xml  调用服务的配置

<dubbo:reference id="xxxx" interface="com.ys.xxxx.xxx.xxxxApi" url="dubbo://10.20.30.164:21331" version="1.0"  />

4.检查发布服务的项目是否启动正常,发布服务的项目没有正常启动也会出现此问题

上一篇:K:java中的RMI(Remote Method Invocation)


下一篇:获取局域网中指定IP或是主机名称的所有文件夹及其搜索文件