2023-11-15 08:58阅读: 543评论: 0推荐: 0

Nacos之Injection of @DubboReference dependencies is failed;

一、遇到的问题

报错:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-11-14 21:05:41.366 ERROR 24464 --- [           main] o.s.boot.SpringApplication               : Application run failed

原因:
在项目的Service实现类中没有引入@Service对应的包 org.apache.dubbo.config.annotation.Service

二、解决方法

方法1:
引入@Service注解对应的包 org.apache.dubbo.config.annotation.Service

import org.apache.dubbo.config.annotation.Service;

@Service
public class LotteryActivityDeploy implements ILotteryActivityDeploy {
}

其他方法:

造成该报错无非这几个原因:扫描不到包、导包导错、注解没加或加错,类型、类名不正确等

排查:查看报错所有日志的Caused by,原因往往在最后一个Caused by。

附件

参考:Error creating bean with name的最佳解决方法

报错:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-11-14 21:05:41.366 ERROR 24464 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'activityServiceImpl': Injection of @DubboReference dependencies is failed; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.nxg.lottery.rpc.activity.deploy.ILotteryActivityDeploy. No provider available for the service com.nxg.lottery.rpc.activity.deploy.ILotteryActivityDeploy from the url dubbo://192.168.56.1/com.nxg.lottery.rpc.activity.deploy.ILotteryActivityDeploy?application=lottery-erp&application.version=1.0.0&dubbo=2.0.2&init=false&interface=com.nxg.lottery.rpc.activity.deploy.ILotteryActivityDeploy&metadata-type=remote&methods=queryActivityListByPageForErp&pid=24464&qos.enable=false&register.ip=192.168.56.1&release=2.7.10&revision=0.0.1-SNAPSHOT&side=consumer&sticky=false&timestamp=1699967140428 to the consumer 192.168.56.1 use dubbo version 2.7.10
	at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.postProcessPropertyValues(AbstractAnnotationBeanPostProcessor.java:149) ~[spring-context-support-1.0.10.jar:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1430) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:755) [spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:402) [spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1247) [spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1236) [spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
	at com.nxg.lottery.erp.LotteryErpApplication.main(LotteryErpApplication.java:23) [classes/:na]
Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.nxg.lottery.rpc.activity.deploy.ILotteryActivityDeploy. No provider available for the service com.nxg.lottery.rpc.activity.deploy.ILotteryActivityDeploy from the url dubbo://192.168.56.1/com.nxg.lottery.rpc.activity.deploy.ILotteryActivityDeploy?application=lottery-erp&application.version=1.0.0&dubbo=2.0.2&init=false&interface=com.nxg.lottery.rpc.activity.deploy.ILotteryActivityDeploy&metadata-type=remote&methods=queryActivityListByPageForErp&pid=24464&qos.enable=false&register.ip=192.168.56.1&release=2.7.10&revision=0.0.1-SNAPSHOT&side=consumer&sticky=false&timestamp=1699967140428 to the consumer 192.168.56.1 use dubbo version 2.7.10
	at org.apache.dubbo.config.ReferenceConfig.checkInvokerAvailable(ReferenceConfig.java:444) ~[dubbo-2.7.10.jar:2.7.10]
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:318) ~[dubbo-2.7.10.jar:2.7.10]
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:206) ~[dubbo-2.7.10.jar:2.7.10]
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.doGetInjectedBean(ReferenceAnnotationBeanPostProcessor.java:163) ~[dubbo-2.7.10.jar:2.7.10]
	at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.getInjectedObject(AbstractAnnotationBeanPostProcessor.java:362) ~[spring-context-support-1.0.10.jar:na]
	at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor$AnnotatedFieldElement.inject(AbstractAnnotationBeanPostProcessor.java:542) ~[spring-context-support-1.0.10.jar:na]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.postProcessPropertyValues(AbstractAnnotationBeanPostProcessor.java:145) ~[spring-context-support-1.0.10.jar:na]
	... 18 common frames omitted
posted @   所遇所思  阅读(543)  评论(0编辑  收藏  举报  
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
🔑
  1. 1 404 not found REOL
  2. 2 偏爱 张芸京
  3. 3 Glimpse of Us Joji
偏爱 - 张芸京
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.

作词 : 葛大为

作曲 : 陈伟

编曲 : 陈伟

把昨天都作废

现在你在我眼前

我想爱 请给我机会

如果我错了也承担

认定你就是答案

我不怕谁嘲笑我极端

相信自己的直觉

相信自己的直觉

顽固的人不喊累

爱上你 我不撤退

我说过 我不闪躲

我说过 我不闪躲

我非要这么做

讲不听 也偏要爱

更努力爱 让你明白

没有别条路能走

你决定要不要陪我

讲不听 偏爱

靠我感觉爱

等你的依赖

对你偏爱

痛也很愉快

把昨天都作废

把昨天都作废

现在你在我眼前

我想爱 请给我机会

如果我错了也承担

认定你就是答案

我不怕谁嘲笑我极端

相信自己的直觉

相信自己的直觉

顽固的人不喊累

爱上你 我不撤退

我说过 我不闪躲

我说过 我不闪躲

我非要这么做

讲不听 也偏要爱

更努力爱 让你明白

没有别条路能走

你决定要不要陪我

讲不听 偏爱

靠我感觉爱

等你的依赖

不后悔 有把握

不后悔 有把握

我不闪躲 我非要这么做

讲不听 也偏要爱

更努力爱 让你明白

没有别条路能走

你决定要不要陪我

讲不听 偏爱

靠我感觉爱

等你的依赖

对你偏爱 爱

痛也很愉快