此文章特此记录写代码时犯的最低级的错误
问题描述:
今天使用dubbo时报错,总是显示消费者无法找到服务提供者的报错情况
这条日志信息表明 Dubbo 消费者在尝试引用服务 com.yupi.project.DemoService
时遇到了问题,具体表现为找不到任何可用的服务提供者
Dubbo Module[1.1.1] refer catch error
:表示 Dubbo 模块在尝试引用服务时捕获到了错误。Dubbo Module[1.1.1] start failed
:表示 Dubbo 模块启动失败,具体原因是没有找到可用的服务提供者。-
具体错误信息:
java.lang.IllegalStateException: Failed to check the status of the service com.yupi.project.DemoService
:表示在检查服务状态时出现了非法状态异常。No provider available for the service com.yupi.project.DemoService
:表示没有找到任何可用的服务提供者。
2024-09-05 18:06:46.102 ERROR 35568 --- [ restartedMain] o.a.d.c.deploy.DefaultModuleDeployer : [DUBBO] Dubbo Module[1.1.1] refer catch error., dubbo version: 3.0.9, current host: 10.24.5.125
2024-09-05 18:06:46.102 ERROR 35568 --- [ restartedMain] o.a.d.c.deploy.DefaultModuleDeployer : [DUBBO] Dubbo Module[1.1.1] start failed: java.lang.IllegalStateException: Failed to check the status of the service com.yupi.project.DemoService. No provider available for the service com.yupi.project.DemoService from the url consumer://10.24.5.125/com.yupi.project.DemoService?application=dubbo-springboot-demo-provider&background=false&dubbo=2.0.2&interface=com.yupi.project.DemoService&methods=sayHello,sayHelloAsync,sayHello2&pid=35568®ister.ip=10.24.5.125&release=3.0.9&side=consumer&sticky=false×tamp=1725530805868 to the consumer 10.24.5.125 use dubbo version 3.0.9, dubbo version: 3.0.9, current host: 10.24.5.125
-
日志内容:
Ignore empty notify urls
:表示 Dubbo 消费者收到了空的订阅结果,即没有找到任何提供者。for subscribe url
:提供了订阅 URL 的详细信息,其中包含了服务名、应用名、接口名以及其他一些 Dubbo 配置参数。
2024-09-05 18:06:45.879 WARN 35568 --- [ restartedMain] o.a.dubbo.registry.nacos.NacosRegistry : [DUBBO] Ignore empty notify urls for subscribe url consumer://10.24.5.125/com.yupi.project.DemoService?application=dubbo-springboot-demo-provider&background=false&category=providers,configurators,routers&dubbo=2.0.2&interface=com.yupi.project.DemoService&methods=sayHello,sayHelloAsync,sayHello2&pid=35568&release=3.0.9&side=consumer&sticky=false×tamp=1725530805868, dubbo version: 3.0.9, current host: 10.24.5.125
配置检查:
1. 服务提供者:
这是我 服务提供者的配置
dubbo:
application:
name: dubbo-springboot-demo-provider
protocol:
name: dubbo
port: -1
registry:
id: nacos-registry
address: nacos://localhost:8848
启动服务和nacos后,访问 http://localhost:8848/nacos ,能看到服务以及注册上来了
2. 服务消费者:
当然启动类也加了@EnbaleDubbo注解
解决:
其实问题很简单,只是我当天智商不在线了,因此记录一下丢脸时刻.....
就因为少建了一个“包”,所以报了错,服务提供者和服务消费者的路径必须一样。
添加后就能运行了