将Spring Boot与ActiveMQ Artemis和MQTT一起使用时出错

我正在使用带有嵌入式activeMQ Artemis的Spring Boot,并且正在添加artemis-mqtt-protocol maven依赖项。它显示以下错误:

AnnotationconfigEmbeddedWebApplicationContext:559] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedactiveMQ' defined in class path resource [com/els/galaxy/gateway/ArtemisConfiguration.class]: invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolManagerFactory.stripPasswordParameters(Ljava/util/Map;)V 
[LocalContainerEntityManagerFactoryBean:597] - Closing JPA EntityManagerFactory for persistence unit 'readPersistenceUnit' =
[LocalContainerEntityManagerFactoryBean:597] - Closing JPA EntityManagerFactory for persistence unit 'writePersistentUnit' 
[session:167] - node0 Stopped scavenging 
[ContextHandler:1045] - Stopped o.s.b.c.e.j.JettyEmbeddedWebAppContext@7bebe5de{application,/galaxy-gateway,[file:///C:/Users/basireddym/AppData/Local/Temp/jetty-docbase.7636853341168462882.86/],UNAVAILABLE} 
[AutoConfigurationReportLoggingInitializer:102] -artemis
wanglei2222 回答:将Spring Boot与ActiveMQ Artemis和MQTT一起使用时出错

在我看来,您使用的artemis-mqtt-protocol的版本比代理的版本新。因此,MQTT协议处理程序中有一些代码正在尝试调用代理中不存在的方法(因为它是较旧的版本)。有问题的方法(即org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolManagerFactory.stripPasswordParameters(Ljava/util/Map;)V)已在Artemis 2.8.0中添加,因此,如果您使用的代理至少不是新的,则它将失败。

请确保您使用的artemis-mqtt-protocol的版本与Spring Boot中代理的版本相同。

本文链接:https://www.f2er.com/3068516.html

大家都在问