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;

    解决结果:成功!
  • 相关阅读:
    【MyEcplise SVN】myEcplise上安装SVN的多种方式
    【微信Java开发 --番外篇】错误解析
    【MyEcplise 插件】反编译插件jad
    maven打包自动配置数据库链接信息
    window.location下的属性说明
    JavaEETest
    java正则过虑字符
    微信小程序开发之大坑记之post请求
    jQuery 获取文件后缀的方法
    java通过解析文件获取apk版本等信息
  • 原文地址:https://www.cnblogs.com/axibug/p/15163384.html
Copyright © 2011-2022 走看看