view raw
Biscuit128 Biscuit128 - 10 months ago 95
Java Question

ActiveMQ connection refused

I am trying to use

in my application, but keep getting an error when I try and connect to localhost:

log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See for more info.
Exception in thread "main" org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: Connection refused
at org.springframework.jms.core.JmsTemplate.execute(
at org.springframework.jms.core.JmsTemplate.send(
at org.springframework.jms.core.JmsTemplate.send(
at sender.MessageSender.sendMessage(
at sender.SenderMain.main(
Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: Connection refused
at org.apache.activemq.util.JMSExceptionSupport.create(
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(
at org.apache.activemq.ActiveMQConnectionFactory.createConnection(
at org.springframework.jms.core.JmsTemplate.execute(
... 4 more
Caused by: Connection refused
at Method)
at org.apache.activemq.transport.tcp.TcpTransport.connect(
at org.apache.activemq.transport.tcp.TcpTransport.doStart(
at org.apache.activemq.util.ServiceSupport.start(
at org.apache.activemq.transport.AbstractInactivityMonitor.start(
at org.apache.activemq.transport.TransportFilter.start(
at org.apache.activemq.transport.WireFormatNegotiator.start(
at org.apache.activemq.transport.TransportFilter.start(
at org.apache.activemq.transport.TransportFilter.start(
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(
... 8 more

There is a file that should be run to start it up (active mq) and this is a
file on windows machines. When you run it then it starts and you leave it running in the command prompt.

At home I have a mac and using the mac equivalent the terminal just prints:

Last login: Mon Oct 29 19:57:15 on ttys000
(null):~ rickilambert$ /Users/rickilambert/Downloads/apache-activemq-5.7.0/bin/macosx/activemq ; exit;
Usage: /Users/rickilambert/Downloads/apache-activemq-5.7.0/bin/macosx/activemq { console | start | stop | restart | status | dump }

[Process completed]

Can anyone please help me to get this thing up and running?

dan dan

Your application is not able to connect to activemq. Check that your activemq is running and listening on localhost 61616.

You can try using: netstat -a to check if the activemq process has started. Or try check if you can access your actvemq using admin page: localhost:8161/admin/queues.jsp

On mac you will start your activemq using:

$ACTMQ_HOME/bin/activemq start 

Or if your config file (activemq.xml ) if located in another location you can use:

$ACTMQ_HOME/bin/activemq start xbean:file:${location_of_your_config_file}

In your case the executable is under: bin/macosx/activemq so you need to use: $ACTMQ_HOME/bin/macosx/activemq start