The pit encountered by dubbo

1. IP acquisition problem

  1. Check online, how does dubbo get the local ip

  2. NetUtilsLooking at the dubbo source code, getLocalAddress0this method in

  3. dubbo gets the ip addresses of all network cards of the machine, and then gets the first 127.0.0.1ip that is not

  4. Set the hosts on the server,vim /etc/hosts

192.168.72.235  localhost hostname

# 192.168.72.235 服务器ip
# localhost
# hostname 是主机名,在/etc/sysconfig/network进行配置

The company uses the dubbo framework as a remote service invocation implementation scheme. In order to facilitate testing, a project is written to directly adjust the dubbo interface for testing. I have encountered a series of strange problems, so it is recorded here.

Q:No provider available for the service com.netease.wyxd.xiezhi.client.open.provider.DetectProvider from registry 10.165.124.69:2181 on the consumer 192.168.233.1 using the dubbo version 2.8.4. Please check if the providers have been started and registered.

A: It prompts me that this ip address cannot call the service provider. First, check if there is a dubbo admin, and confirm that there is no problem. Oh, there is one place, that is, the service registration on zk uses the network address of the computer room by default (here the machine has a private network address, a computer room address, and a public network address. The network address of the computer room is mainly for the communication between servers, and the local service adjustment server is generally It is a private network or a public network), since the address exposed by the service on the admin is the network address of the computer room, so you need to add a configuration to the environment variable -Ddubbo.protocol.host=10.165.124.89 or add it in dubbo.properties

My problem here is rather strange. The consumer's ip is not my local ip, so I cleared the network. My public network address should be 10.242.111.206. This is my normal ip.

 

Q: java.lang.IllegalStateException: Unsupported protocol hessian in notified url

A: I checked this for a long time and there are not many on the Internet. Then I tried it myself because the hession.jar package did not add == ORZ...

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325070286&siteId=291194637