1、通过dubbo广播方式(multicast)本地启动provider和consumer
2、通过telnet查看
dubbo接口TestService发布成功
3、通过consumer调用报错
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Mar 12 09:54:27 CST 2020
There was an unexpected error (type=Internal Server Error, status=500).
Failed to invoke the method test in the service hao.du.dubbo.learn.service.base.TestService. No provider available for the service hao.du.dubbo.learn.service.base.TestService:1.0.0 from registry 224.5.6.19:1244 on the consumer 192.168.234.1 using the dubbo version 2.7.3. Please check if the providers have been started and registered.
发现192.168.234.1和本机ip 192.168.1.118不一样。
4、查资料后以为是windows虚拟机ip导入provider和consumer广播ip不一致导致,consumer找不到接口,于是关掉了虚拟机适配器,关闭后只有一个本机真实ip
5、重新启动provider和consumer,仍然报错
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Mar 12 09:54:27 CST 2020
There was an unexpected error (type=Internal Server Error, status=500).
Failed to invoke the method test in the service hao.du.dubbo.learn.service.base.TestService. No provider available for the service hao.du.dubbo.learn.service.base.TestService:1.0.0 from registry 224.5.6.19:1244 on the consumer 192.168.1.118 using the dubbo version 2.7.3. Please check if the providers have been started and registered.
ip倒是变过来了,但是任然找不到dubbo接口。
6、灵光一现问题解决
突然想到广播方式莫非只是启动的时候发布一下消息,然后就不管了?我之前启动方式都是按照springcloud来的先启动服务提供者再启动服务消费者,这样可能导致服务启动的时候广播出去消费者没有接收到。于是改变了服务启动顺序,果然,我凑特么的!