SpringBoot集成RocketMQ报错:Bad annotation definition in @ExtRocketMQTemplateConfiguration...

1.问题缘由

使用官方提供的rocketmq-spring-boot-starter提供的例子写ExtRocketMQTemplate时候,修改了配置文件中的nameServer配置,改成了和rocketmq.name-server一样的值:

## 配置文件
rocketmq:
  name-server: 192.168.2.182:9876;192.168.2.183:9876
...
demo:
  rocketmq:
    ...
    extNameServer: 192.168.2.182:9876;192.168.2.183:9876

## Java Code
@ExtRocketMQTemplateConfiguration(nameServer = "${demo.rocketmq.extNameServer}")
public class ExtRocketMQTemplate extends RocketMQTemplate {
}

2.问题描述

贴上了堆栈信息:

org.springframework.beans.factory.support.BeanDefinitionValidationException: Bad annotation definition in @ExtRocketMQTemplateConfiguration, nameServer property is same with global property, please use the default RocketMQTemplate!
    at org.apache.rocketmq.spring.autoconfigure.ExtProducerResetConfiguration.validate(ExtProducerResetConfiguration.java:153) ~[rocketmq-spring-boot-2.0.3.jar:2.0.3]
    at org.apache.rocketmq.spring.autoconfigure.ExtProducerResetConfiguration.registerTemplate(ExtProducerResetConfiguration.java:88) ~[rocketmq-spring-boot-2.0.3.jar:2.0.3]
    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:1.8.0_144]
    at org.apache.rocketmq.spring.autoconfigure.ExtProducerResetConfiguration.afterSingletonsInstantiated(ExtProducerResetConfiguration.java:75) ~[rocketmq-spring-boot-2.0.3.jar:2.0.3]
...

3.问题解决

根据报错提示,nameServer不能设置为和上面rocketmq.name-server一样的值,改为不一样即可解此问题:

rocketmq:
  name-server: 192.168.2.182:9876;192.168.2.183:9876
...
# properties used in the application
demo:
  rocketmq:
    ...
    extNameServer: 192.168.2.182:9876

原文地址:https://www.cnblogs.com/HeCG95/p/11784783.html

时间: 2024-11-06 15:30:43

SpringBoot集成RocketMQ报错:Bad annotation definition in @ExtRocketMQTemplateConfiguration...的相关文章

SpringBoot集成MybatisPlus报错

SpringBoot集成MybatisPlus报错 启动的时候总是报如下错误: java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class 解决方案 需要一个mybatis-spring-boot-starter的包,在pom文件加上之后,完美解决. <dependency> <groupId>org.mybatis.spring.boot</grou

springboot集成redis 报错@Bean definition illegally overridden by existing bean [email&#160;protected]定义被现有bean定义非法重写

在做springboot集成redis时报如下错误: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'cacheManager' defined in class path resource [org/springframework/boot/autoconfigure/cache/RedisCacheConfiguration.class]: @

Android Studio集成SVN报错:can&#39;t use subversion command line client : svn

Android Studio集成SVN插件,check out出代码后,每次开启都会在右上角出现如下错误: Can't use Subversion command line client: svn Probably the path to Subversion executable is wrong. Fix it. Errors found while svn working copies detection. Fix it. 下面直接上解决方案吧: 1.安装客户端http://ncu.dl

springboot项目启动报错 url&#39; attribute is not specified and no embedded datasource could be configured

报错相关信息: 2019-07-22 17:12:48.971 ERROR 8312 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Failed to configure a DataSource: 'url' attribute is not

第一个springboot项目启动报错Failed to configure a DataSource: &#39;url&#39; attribute is not specified and no embedded datasource could be configured.

报错内容具体如下 *************************** APPLICATION FAILED TO START *************************** Description: Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. Reason: Failed to determine a

springboot 新工程报错 Failed to configure a DataSource: &#39;url&#39; attribute is not specified and no embedded datasource could be configured.

错误日志 ... ... Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2020-04-02 12:52:47.306 ERROR 22036 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLIC

idea中的springboot+gradle项目报错springboot configuration annotation processor not found in classpath

idea中的springboot项目,打开某个类run.halo.app.config.properties.HaloProperties.java,报错(使用gradle编译): springboot configuration annotation processor not found in classpath 网上的解决方案是pom.xml文件里面添加如下配置. <!-- 自定义的元数据依赖-><dependency> <groupId>org.springfr

spring-boot:run启动报错

Intellij Idea中的spring boot项目,使用main方法运行可以启动,但是使用mvn spring-boot:run启动总是报错 大概意思就是找不到类:org/apache/maven/shared/artifact/filter/collection/ArtifactsFilter 原来是没有在仓库中找到对应的插件,指定一个找得到的版本号即可解决 <build> <plugins> <plugin> <groupId>org.spring

springboot添加ojdbc6报错

springboot一般添加ojdbc6数据库驱动会报错,依赖无法添加.原因ojdbc6数据库驱动是收费的,无法通过maven直接进行下载,需要手动下载ojdbc6.jar,把其手动添加到自己的仓库里面 第一步下载ojdbc6的jar包 下载的地址 https://mvnrepository.com/artifact/com.oracle/ojdbc6/11.2.0.3 选择jar将其下载下来 第二步将自己下载下来的jar重命名ojdbc6放到c盘用户的目录下 第三步这个目录打开cmd窗口 执行