• 依赖注入异常org.springframework.beans.factory.UnsatisfiedDependencyException


    异常名称:UnsatisfiedDependencyException & BeanCreationException &IllegalStateException

    异常分析:某个接口(CommentApi) 没有注入到dubbo里去

    异常原因:一时手滑将某个接口实现类@Service导错包...

    异常详情:

    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'xxxxController':
    Unsatisfied dependency expressed through field 'xxxxService'; nested exception is org.springframework.beans.factory.BeanCreationException:
    Error creating bean with name 'xxxxxService': Injection of @Reference dependencies is failed; nested exception is java.lang.IllegalStateException:
    Failed to check the status of the service com.xxx.api.mongo.CommentApi. No provider available for the service com.tanhua.api.mongo.CommentApi from
    the url zookeeper://192.168.136.160:2181/org.apache.dubbo.registry.RegistryService?application=xxxx-app&dubbo=2.0.2&init=false&interface=com.xxxx.api.mongo.CommentApi&methods=save,
    findComments,delete&pid=13408&qos.enable=false&register.ip=10.253.6.42&release=2.7.5&side=consumer&sticky=false&timestamp=1629368120258 to the consumer 10.253.6.42
    use dubbo version 2.7.5

    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
    at com.tanhua.AppStart.main(AppStart.java:15) [classes/:na]

     

    解决方案:重新导包 将 import org.springframework.stereotype.Service;

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

    解决结果:成功!
  • 相关阅读:
    非洲出现新蓝海,他们抓住机遇将产品加工反向送入国内市场
    npm ERR! code ERR_STREAM_WRITE_AFTER_END
    程序默认不自动重连oracle
    一份超详细的MySQL高性能优化实战总结
    佩奇送福利:Eygle系列书籍免费下载
    解决waiting for target deviceto come online的做法
    Android真机运行闪退问题
    他是如何将小店铺打造成餐饮品牌的?
    用两张图告诉你,为什么你的App会卡顿?
    用两张图告诉你,为什么你的App会卡顿?
  • 原文地址:https://www.cnblogs.com/axibug/p/15163384.html
Copyright © 2020-2023  润新知