apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.55k stars 26.44k forks source link

客户端无法调用Hessian协议接口超时 #5278

Closed cookiejoo closed 5 years ago

cookiejoo commented 5 years ago

dubbo版本2.7.1,springboot版本2.1.3.RELEASE

客户端配置: spring.application.name=demo-consumer dubbo.scan.base-packages=com.demo.consumer dubbo.registry.protocol=zookeeper dubbo.registry.address=127.0.0.1:2181

//但是version一定要指定 不然会找不到服务 直连需要加url="dubbo://localhost:12345",端口号和配置文件中保持一致,,protocol = "hessain"
@Reference(version = "1.1", timeout = 4000,url = "hessian://192.168.1.101:20881/com.demo.provider.service.IMyService")
private IMyService myService;

@GetMapping("/hello")
public String sayHello() {
    return myService.sayHello("Cookie");
}

服务端spring配置: dubbo.scan.basePackages=com.demo.provider dubbo.application.name=demo-provider dubbo.registry.protocol=zookeeper dubbo.registry.address=127.0.0.1:2181

dubbo.protocol.name=hessian dubbo.protocol.port=20881 dubbo.protocol.server=servlet dubbo admin上已经显示注册到zk了,但是客户端调用一直是超时

异常: : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.caucho.hessian.client.HessianRuntimeException: java.net.ConnectException: Connection refused] with root cause

java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_77]

cookiejoo commented 5 years ago

我服务端改用dubbo协议的正常的

chickenlj commented 5 years ago

客户端收到的网络地址是正确的么?看起来是建立链接失败了。

cookiejoo commented 5 years ago

客户端收到的网络地址是正确的么?看起来是建立链接失败了。

怎麽解決?其他同事也遇到這個問題了,2.6版本沒問題.