ActiveMQ Could not connect to broker URL

时间:2022-08-22 13:44:32

javax.jms.JMSException: Could not connect to broker URL: http://localhost:8161/. Reason: java.io.IOException: Failed to perform GET on: http://localhost:8161/ as response was: Not Found

该错误是由地址引起的,将“http://localhost:8161”改为“tcp://localhost:61616”即可。

connectionFactory = new ActiveMQConnectionFactory(ActiveMQConnection.DEFAULT_USER, ActiveMQConnection.DEFAULT_PASSWORD, "tcp://localhost:61616");