dubbo项目:

启动项目报错:(web端)

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.refile.api.service.UserService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

原因:

一直以为是dubbo端服务没有正常提供接口服务,但发现报错的内容和找不到dubbo接口服务异常内容不一样,所以怀疑不是dubbo提供接口服务问题。

找了半天发现是web端启动的时候没有扫描到dubbo消费端的配置文件。

解决办法:

修改web.xml文件的内容:

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring/refile-mvc.xml</param-value>
    </context-param>

改为classpath:spring/*.xml

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring/*.xml</param-value>
</context-param>

spring监听器:

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring/refile-mvc.xml</param-value>
    </context-param>

 

相关文章:

  • 2021-04-16
  • 2021-07-27
  • 2021-10-03
  • 2021-07-09
  • 2021-05-24
  • 2021-11-16
  • 2021-12-31
  • 2021-10-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-22
  • 2021-10-17
  • 2022-01-07
  • 2021-04-06
  • 2021-09-27
相关资源
相似解决方案