ActiveMQ 生产者发送消息失败:refuse connect
Posted Adorable_Rocy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActiveMQ 生产者发送消息失败:refuse connect相关的知识,希望对你有一定的参考价值。
在生产者发送消息时,出现如下报错:
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_181]
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_181]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_181]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_181]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_181]
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_181]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_181]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_181]
at org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:525) ~[activemq-client-5.14.5.jar:5.14.5]
at org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:488) ~[activemq-client-5.14.5.jar:5.14.5]
at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:55) ~[activemq-client-5.14.5.jar:5.14.5]
at org.apache.activemq.transport.AbstractInactivityMonitor.start(AbstractInactivityMonitor.java:169) ~[activemq-client-5.14.5.jar:5.14.5]
at org.apache.activemq.transport.InactivityMonitor.start(InactivityMonitor.java:52) ~[activemq-client-5.14.5.jar:5.14.5]
at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:64) ~[activemq-client-5.14.5.jar:5.14.5]
at org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:72) ~[activemq-client-5.14.5.jar:5.14.5]
at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:64) ~[activemq-client-5.14.5.jar:5.14.5]
at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:64) ~[activemq-client-5.14.5.jar:5.14.5]
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:354) ~[activemq-client-5.14.5.jar:5.14.5]
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:304) ~[activemq-client-5.14.5.jar:5.14.5]
at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:244) ~[activemq-client-5.14.5.jar:5.14.5]
at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180) ~[spring-jms-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474) ~[spring-jms-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:559) ~[spring-jms-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.jms.core.JmsMessagingTemplate.doSend(JmsMessagingTemplate.java:325) ~[spring-jms-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.jms.core.JmsMessagingTemplate.doSend(JmsMessagingTemplate.java:46) ~[spring-jms-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105) ~[spring-messaging-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:143) ~[spring-messaging-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:123) ~[spring-messaging-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:118) ~[spring-messaging-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at fatcats.cloud.mq.RegisterMailboxProd.sendMsg(RegisterMailboxProd.java:22) ~[classes/:na]
at fatcats.cloud.api.service.impl.MemberServiceImpl.sendMsg(MemberServiceImpl.java:103) ~[classes/:na]
at fatcats.cloud.api.service.impl.MemberServiceImpl.register(MemberServiceImpl.java:85) ~[classes/:na]
联想到很多的可能性:
1.端口被占用
2.不在同一网络,即防火墙保护
3.服务器未启动
4.端口不正确
按照思路排查一下子就解决了
以上是关于ActiveMQ 生产者发送消息失败:refuse connect的主要内容,如果未能解决你的问题,请参考以下文章