Search code examples
javajmsactivemq-classicmessagingspring-jms

Spring JMS Baeldung tutorial code cannot connect to ActiveMQ


I have successfully built example code from this repo. However, when I run this testing application I get the following error:

ERROR | Could not refresh JMS Connection for destination 'queue-1' - retrying using FixedBackOff{interval=5000, currentAttempts=2, maxAttempts=unlimited}. Cause: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused: no further information

I'm not sure where to start troubleshooting. I tried it on my work PC and on an EC2 Windows instance to make sure it's not my company firewall or something like that. Result is the same on both machines.


Solution

  • To start the embedded ActiveMQ broker I needed to run unit tests included with the project.

    The unit test included broker initialization:

    public static EmbeddedActiveMQBroker embeddedBroker = new EmbeddedActiveMQBroker();