首页 > 解决方案 > 如何解决 org.springframework.jms.config.JMSListenerEndpointRegister.isAutoStartUp()Z 错误?

问题描述

所以我正在构建一个 SpringFramework(4.3.20.RELEASE) 项目,向/从 activemq 服务器发送和接收消息(在这种情况下,我在 localhost 上拥有它)。

我能够将消息发送到队列,但无法从那里获取。这是我的消费者类和消费者配置类。

这是我在 POM 中的依赖项

<!-- JMS -->
       <dependency>
           <groupId>org.springframework</groupId>
           <artifactId>spring-jms</artifactId>
           <version>5.1.5.RELEASE</version>
       </dependency>
       <dependency>
           <groupId>javax.jms</groupId>
           <artifactId>javax.jms-api</artifactId>
           <version>2.0.1</version>
       </dependency>
       <dependency>
           <groupId>org.apache.activemq</groupId>
           <artifactId>activemq-all</artifactId>
           <version>5.10.0</version>
       </dependency>

这是我的 ConsumerConfig 类

@Configuration
@EnableJms
public class ReceiverConfig {

    private String brokerUrl = "tcp://localhost:61616";

    @Bean
    public ActiveMQConnectionFactory receiverActiveMQConnectionFactory() {
        ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory();
        activeMQConnectionFactory.setBrokerURL(brokerUrl);

        return activeMQConnectionFactory;
    }

    @Bean
    public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() {
        DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
        factory.setConnectionFactory(receiverActiveMQConnectionFactory());
        factory.setConcurrency("1-1");

        return factory;
    }

    @Bean
    public Receiver receiver() {
        return new Receiver();
    }
}

和消费类

public class Receiver {

    private static final Logger logger = LoggerFactory.getLogger(Receiver.class);

    @Autowired
    private Processor processor;

    @JmsListener(destination = "my.queue", containerFactory = "jmsListenerContainerFactory")
    public void receive(String message) {
        logger.info("We have read message " + message + " from Queue");
    }

}

我得到的错误

[2020-03-24 04:57:53,405] Artifact {my-project}:war: java.lang.Exception: {"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host.\"/{my-project}\"" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host.\"/{my-project}\": java.lang.AbstractMethodError: org.springframework.jms.config.JmsListenerEndpointRegistry.isAutoStartup()Z
    Caused by: java.lang.AbstractMethodError: org.springframework.jms.config.JmsListenerEndpointRegistry.isAutoStartup()Z"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.deployment.default-server.default-host.\"/{my-project}\""],"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}

标签: javaspringactivemqspring-jmsconfigure

解决方案


推荐阅读