zoukankan      html  css  js  c++  java
  • 依赖注入异常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;

    解决结果:成功!
  • 相关阅读:
    PowerDesigner概念设计模型(CDM)中的3种实体关系
    基于Prototype 1.6.2 框架下的数据分页
    中国地区,北京54坐标系条带号的选
    C#中MessageBox的使用
    C#注册表的读,写,删除,查找 (转)
    C# Tostring() 格式大全 [转]
    Layer features in this layer set, ArcEngine图层标注源码 (转)
    判断点是否在多边形之内的方法
    C#导入Excel到Dataset和导出Excel到DataTable
    Server.MapPath方法的应用方法
  • 原文地址:https://www.cnblogs.com/axibug/p/15163384.html
Copyright © 2011-2022 走看看