ActiveMQ 连接失败异常

ActiveMQ ConnectionFailedException

我正在尝试 post 使用 JMS 向 ActiveMQ 发送消息,

String loginID="admin";
String loginPswd="admin";
String hostName="svful0000283np.nyzdc.local";
String channel="http";
String portNumber="8161";
String hostUrl=channel + "://" + hostName + ":" + portNumber;
String inputQueue="com.nbn.telecom.sap.ManageSQ";
String outputQueue="com.nbn.telecom.sap.ManageSQ.response";

String messageText="my text";                              
ConnectionFactory factory = new ActiveMQConnectionFactory(loginID, loginPswd,hostUrl);         
Connection connection = factory.createConnection();   
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

上面的最后一条语句给出了以下错误消息 -

   org.apache.activemq.ConnectionFailedException: The JMS connection has failed:            Failed to perform GET on: http://svful0000283np.nyzdc.local:8161 Reason: null

错误的原因可能是什么?预先感谢您的帮助

在再次理解您的问题时,我看到 8161 端口...它是 jetty 默认端口 。 ...为管理提供 ActiveMQ 管理控制台.....

您只能将其消息端口用于消息传送..... openwire、amqp、stomp 的端口 61616、5672、61613、1883、61614 , mqtt, ws protocol messaging 分别.....

该配置就在这里....在'[ACTIVEMQ_HOME]/conf/activemq.xml'

          <transportConnectors>
                <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
                <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
                <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
                <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
                <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
                <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
          </transportConnectors>

如果不冲突,您可以将端口更改为其他号码....

0.0.0.0 仅适用于环回 IP 127.0.0.1...我的意思是仅在本地主机....

否则,如果它是 unix,则通过 ifconfig 查找 ip 来替换 ip 0.0.0.0.....否则 ipconfig 如果它是 Windows 或基于 DOS...应该在你所在的机器上完成 运行 ActiveMQ