springboot 整合 ActiveMQ 连接池报错

本文主要探讨了SpringBoot在整合ActiveMQ时遇到的连接池报错问题,详细介绍了配置步骤、启动时出现的错误信息,并深入剖析了产生错误的原因,涉及不同版本间的差异及对应的解决策略。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

配置

spring:
  activemq:
    user: user
    password: user
    broker-url: tcp://localhost:61616
    in-memory: true
    pool:
      enabled: true
      max-connections: 5
      idle-timeout: 30000

启动时的报错信息

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueMQProducer':
Unsatisfied dependency expressed through field 'jmsMessagingTemplate'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type 'org.springframework.jms.core.JmsMessagingTemplate' available: expected at least 1 bean which qualifies as autowire candidate. 
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

原因说明

  • springboot版本不同,引入的pool也不同
    • 2.1++版本的springboot,引入如下的连接池
     <dependency>
      	<groupId>org.messaginghub</groupId>
      	<artifactId>pooled-jms</artifactId>
    </dependency>
    
  • 2.0+版本的springboot引入如下的连接池
    <dependency>
       <groupId>org.apache.activemq</groupId>
       <artifactId>activemq-pool</artifactId>
    </dependency>
    
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值