背景

今天将一个SpringBoot项目的配置参数从原有的.yml文件迁移到Apollo后,启动报错“Bean method 'rocketMQTemplate' in 'RocketMQAutoConfiguration' not loaded because @ConditionalOnBean (types: org.apache.rocketmq.client.producer.DefaultMQProducer; SearchStrategy: all) did not find any beans of type org.apache.rocketmq.client.producer.DefaultMQProducer”。花了两个小时才最终搞清楚,原因是缺少了配置项 spring.rocketmq.producer.group 从而导致无法成功创建RocketMQAutoConfiguration这个Bean,从而导致一连串对此有依赖的Bean无法创建成功。

排查过程

启动的错误日志

2019-04-02 15:21:33.689  WARN 17516 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myServiceAImpl': Unsatisfied dependency expressed through field 'myServiceBImpl'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myServiceAImpl': Unsatisfied dependency expressed through field 'rocketMQTemplate'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.apache.rocketmq.spring.starter.core.RocketMQTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2019-04-02 15:21:33.692 INFO 17516 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed
2019-04-02 15:21:33.693 INFO 17516 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService
2019-04-02 15:21:33.693 INFO 17516 --- [ main] f.a.ReferenceAnnotationBeanPostProcessor : class com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor was destroying!
2019-04-02 15:21:33.702 INFO 17516 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-04-02 15:21:33.842 ERROR 17516 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : ***************************
APPLICATION FAILED TO START
*************************** Description: Field rocketMQTemplate in net.yourpackage.myServiceBImpl required a bean of type 'org.apache.rocketmq.spring.starter.core.RocketMQTemplate' that could not be found.
- Bean method 'rocketMQTemplate' in 'RocketMQAutoConfiguration' not loaded because @ConditionalOnBean (types: org.apache.rocketmq.client.producer.DefaultMQProducer; SearchStrategy: all) did not find any beans of type org.apache.rocketmq.client.producer.DefaultMQProducer Action: Consider revisiting the conditions above or defining a bean of type 'org.apache.rocketmq.spring.starter.core.RocketMQTemplate' in your configuration.

问题原因

从上图中可以看到RocketMQAutoConfiguration中的mqProducer方法会根据配置参数来创建DefaultMQProducer,其中有两个必要的参数
  • spring.rocketmq.nameServer
  • spring.rocketmq.producer.group
在重新检查了一遍配置文件后发现,的确是因为漏掉了spring.rocketmq.producer.group,将其加上之后便可以成功启动项目了。

问题排查之'org.apache.rocketmq.spring.starter.core.RocketMQTemplate' that could not be found.- Bean method 'rocketMQTemplate' in 'RocketMQAutoConfiguration' not loaded.的更多相关文章

  1. 【报错】spring整合activeMQ,pom.xml文件缺架包,启动报错:Caused by: java.lang.ClassNotFoundException: org.apache.xbean.spring.context.v2.XBeanNamespaceHandler

    spring版本:4.3.13 ActiveMq版本:5.15 ======================================================== spring整合act ...

  2. Apache RocketMQ 消息队列部署与可视化界面安装

    一.介绍 Apache RocketMQ是一个分布式.队列模型的消息中间件,具有低延迟.高性能和高可靠.万亿级容量和灵活的可扩展性.核心组件由四部分组成:Name Servers,Brokers,Pr ...

  3. 【Apache RocketMQ】RocketMQ捐赠给Apache那些鲜为人知的故事-转自阿里中间件

    序言 今年的双十一对阿里巴巴中间件消息团队来说,注定是个不平凡的日子.在这一天,稳定性小组重点攻克的低延迟存储解决方案成功地经受住了大考.整个大促期间,99.996%的延迟落在了10ms以内,极个别由 ...

  4. Apache RocketMQ在linux上的常用命令

    Apache RocketMQ在linux上的常用命令 进入maven安装后的rocketmq的bin目录  1.启动Name Server  2.启动Broker 3.关闭Name Server 4 ...

  5. 【shiro】报错:Caused by: java.lang.ClassNotFoundException: org.apache.shiro.spring.LifecycleBeanPostProcessor

    Caused by: java.lang.ClassNotFoundException: org.apache.shiro.spring.LifecycleBeanPostProcessor at o ...

  6. Apache RocketMQ 正式开源分布式事务消息

    近日,Apache RocketMQ 社区正式发布4.3版本.此次发布不仅包括提升性能,减少内存使用等原有特性增强,还修复了部分社区提出的若干问题,更重要的是该版本开源了社区最为关心的分布式事务消息, ...

  7. Apache RocketMQ 的过去、现在和未来 原创: DataPipeline DataPipeline数见科技 前天

    Apache RocketMQ 的过去.现在和未来 原创: DataPipeline DataPipeline数见科技 前天

  8. Apache Camel,Spring Boot 实现文件复制,转移 (转)

    基本框架 Apache Camel Spring Boot Maven 开发过程 1.新建一个POM(quickstart)项目,在POM文件中添加Camel和Spring Boot的依赖 <p ...

  9. org.apache.rocketmq.remoting.exception.RemotingTooMuchRequestException: sendDefaultImpl call timeout 和 RocketmqRemoting closeChannel: close the connection to remote address[] result: true

    org.apache.rocketmq.remoting.exception.RemotingTooMuchRequestException: sendDefaultImpl call timeout ...

随机推荐

  1. jenkins不安装任何插件时,是什么样的

    因为jenkins中插件众多,很多时候大家默认安装的话,会默认安装一堆插件.而很多插件会给jenkins的各个方面去增强它, 一致于不清楚哪些功能是插件提供的,还是jenkins自带的. 所以下面将没 ...

  2. async 与await

    一. async 与await (https://segmentfault.com/a/1190000007535316) 1.async 是“异步”的简写,而 await 可以认为是 async w ...

  3. (转载)解决AndroidStudio导入项目在 Building gradle project info 一直卡住

    源地址http://blog.csdn.net/yyh352091626/article/details/51490976 Android Studio导入项目的时候,一直卡在Building gra ...

  4. Minix中的字符判定ctype.c

    minix中关于如何判定一个字符的类型,如大写.小写.数字…… 如果采用传统的方法,如判断一个字母大写的方法: if(c>='A' && c<'Z') return tru ...

  5. Spark2 ML包之决策树分类Decision tree classifier详细解说

    所用数据源,请参考本人博客http://www.cnblogs.com/wwxbi/p/6063613.html 1.导入包 import org.apache.spark.sql.SparkSess ...

  6. Spring Framework核心概念之Bean生命周期管理

    目录 Spring Bean的生命周期 相关接口的分类 测试SpringBean生命周期的Demo程序 小结 Spring Bean的生命周期 Spring容器既Application或者WebApp ...

  7. 使用keras导入densenet模型

    从keras的keras_applications的文件夹内可以找到内置模型的源代码 Kera的应用模块Application提供了带有预训练权重的Keras模型,这些模型可以用来进行预测.特征提取和 ...

  8. HDU 1565 - 方格取数(1) - [状压DP][网络流 - 最大点权独立集和最小点权覆盖集]

    题目链接:https://cn.vjudge.net/problem/HDU-1565 Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32 ...

  9. easyui-datagrid个人实例

    这个实例数据表格的功能,可以实现分页,增删改查功能 1.user.jsp <%@ page language="java" contentType="text/ht ...

  10. HFTP Guide

    Introduction(说明) HFTP is a Hadoop filesystem implementation that lets you read data from a remote Ha ...