Java – ActiveMQ connection denied

I tried to use ActiveMQ in my application, but when I tried to connect to the local host, an error continued to appear:

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 http://logging.apache.org/log4j/1.2/faq.html#noconfig 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: java.net.ConnectException: Connection refused
    at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)
    at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
    at org.springframework.jms.core.jmstemplate.execute(jmstemplate.java:469)
    at org.springframework.jms.core.jmstemplate.send(jmstemplate.java:534)
    at org.springframework.jms.core.jmstemplate.send(jmstemplate.java:526)
    at sender.MessageSender.sendMessage(MessageSender.java:16)
    at sender.SenderMain.main(SenderMain.java:13)
Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused
    at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
    at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:293)
    at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:238)
    at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:184)
    at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
    at org.springframework.jms.core.jmstemplate.execute(jmstemplate.java:456)
    ... 4 more
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
    at java.net.socksSocketImpl.connect(SocksSocketImpl.java:432)
    at java.net.socket.connect(Socket.java:529)
    at org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:504)
    at org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:467)
    at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:55)
    at org.apache.activemq.transport.AbstractInactivityMonitor.start(AbstractInactivityMonitor.java:132)
    at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58)
    at org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:72)
    at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58)
    at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58)
    at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:273)
    ... 8 more

You should run a file to start it (active MQ), which is on a Windows machine Bat file When you run it, then it starts, you let it run at the command prompt

I have a Mac at home and use a Mac equivalent terminal to print:

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 }
logout

[Process completed]

Can anyone help me get this thing going?

Solution

Your application cannot connect to ActiveMQ Check if your ActiveMQ is running and listening on localhost 616

You can try: netstat - A to check whether the ActiveMQ process has started Or try checking to see if you can access your actvemq: localhost: 8161 / admin / queues. Com using the administration page jsp

On the Mac, you will start ActiveMQ with the following command:

$ACTMQ_HOME/bin/activemq start

Or if your configuration file (ActiveMQ. XML) is 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: bin / MacOSX / ActiveMQ, so you need to use: $actmq_ HOME / bin / macosx / activemq start

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>