迁移到 Spring Boot 3 和 Java 17 时出现 Activemq-artemis 错误

问题描述 投票:0回答:1

使用 Artemis 2.29.0.

来自 org.apache.active.mq 的 pom.xml 中的依赖项 -

  • artemis-核心-客户端
  • artemis-雅加达-客户端
  • artemis-commons
  • artemis-经纪人
  • artemis-jms-客户端
  • artemis-服务器
  • activemq-broker 5.16.7
  • activemq-客户端5.16.7
  • activemq-openwire-legacy 5.16.7

出现错误:

Caused by: jakarta.jms.JMSException: Failed to create session factory
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:891)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:290)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:285)
at org.springframework.jms.connection.SingleConnectionFactory.doCreateConnection(SingleConnectionFactory.java:452)
at org.springframework.jms.connection.SingleConnectionFactory.initConnection(SingleConnectionFactory.java:414)
at org.springframework.jms.connection.SingleConnectionFactory.getConnection(SingleConnectionFactory.java:328)
at org.springframework.jms.connection.SingleConnectionFactory.createConnection(SingleConnectionFactory.java:243)
at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:211)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:517)
7 more

Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:726)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:889)
15 more

服务构建时没有任何错误,但在运行一些集成测试时出现错误。

java jms activemq-artemis
1个回答
0
投票

我不知道你之前使用的 Spring 版本是什么,但在 Spring 3 中你应该使用如下配置。错误看起来您连接到了错误的实例。

spring.artemis.mode=native
spring.artemis.broker-url=tcp://x.x.x.x:61616
spring.artemis.user=admin
spring.artemis.password=secret
© www.soinside.com 2019 - 2024. All rights reserved.