我正在尝试连接到具有旧版配置(远程: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>
最佳答案
看起来EAP 7.1(在Apache Artemis 1.x上)与客户端代码(在Apache Artemis 2.10上)之间不匹配。