Ann
Ann

Reputation: 57

JmsTemplate.convertAndSend throws Uncategorized exception - ActiveMQ SpringBoot configuration

I believe that i messed up with configuration but I cannot get where and how to fix it. Here you can find code.

org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused: connect

at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:311)
at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:185)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:507)
at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:584)
at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:661)
at com.example.jms.activemqpractice.messaging.MessageSender.send(MessageSender.java:16)

I know that his one could be marked as duplicate, but I could not find answer that would fix my problem.

Upvotes: 0

Views: 11068

Answers (1)

Gary Russell
Gary Russell

Reputation: 174574

spring.activemq.broker-url=tcp://localhost:61616

.

Connection refused:

Simply means that you don't have activemq running on localhost:61616

The tcp:// scheme means the broker must be running already, usually in another process, or you need to add a broker to your application with the tcp transport.

If you just want to use an embedded broker within your application, use

vm://localhost

or

vm://localhost?broker.persistent=false

if you don't want to persist messages between runs.

Upvotes: 3

Related Questions