Spring JMS无法连接到JBoss EAP 7.1 ActiveMq Artemis

时间:2019-10-28 19:42:36

标签: java spring jboss jboss-eap-7

我正在尝试连接到具有旧版配置(远程:4447)的EAP 7.1上的ActiveMq Artemis。我可以使用端口5445使用JMSToolBox进行连接,但是当我想从Spring Boot应用程序中使用remote:// xxx:4447访问服务器时,会收到此警告

  

目标“ java:/ queue / party”的JMS消息侦听器调用程序的设置失败-试图恢复。原因:org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage_V2无法转换为org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage_V3

还有很多这样的警告。

  

AMQ212052:数据包PACKET(SessionQueueQueryResponseMessage_V2)[type = -7,channelID = 13,packetObject = SessionQueueQueryResponseMessage_V2,address = null,name = null,ConsumerCount = 0,filterString = null,持久性= false,存在= false,临时= false,messageCount = 0,autoCreationEnabled = false]由于先前的服务器超时而被无序回答,因此被忽略

我没有访问JBoss服务器的权限,但被告知配置很好。这是我的配置。

@Bean
public ConnectionFactory connectionFactory() {
    final Hashtable<String, Object> env = new Hashtable<>();
    env.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
    env.put(Context.PROVIDER_URL, providerUrl);
    env.put("jboss.naming.client.ejb.context", true);
    env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

    try {
        final Context ctx = new InitialContext(env);
        final String cfLookupName = "jms/RemoteConnectionFactory";

        final ConnectionFactory factory = (ConnectionFactory) ctx.lookup(cfLookupName);
        ctx.close();
        return factory;
    }
    catch (final NamingException e) {
        LOGGER.error(String.format("Error while connecting to JMS. %s", e));
    }
    return null;
}

@Bean
public JmsListenerContainerFactory<?> jmsConnectionFactory(
        final ConnectionFactory connectionFactory,
        final DefaultJmsListenerContainerFactoryConfigurer configurer) {
    final DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    configurer.configure(factory, connectionFactory);
    return factory;
}

application.yml

jms:
  context-factory: org.wildfly.naming.client.WildFlyInitialContextFactory
  provider-url: remote://<hostname>:4447

我不确定是否相关,但是我在Maven中使用了这种依赖关系:

    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-jms-client-bom</artifactId>
    <version>18.0.0.Final</version>
    <type>pom</type>

1 个答案:

答案 0 :(得分:0)

似乎EAP 7.1(在Apache Artemis 1.x上)和客户端代码(在Apache Artemis 2.10上)之间不匹配。

相关问题