[英]Connecting to remote activemq instance running on docker container
I have 2 docker containers, one running a spring app (in tomcat) and one running an active mq instance. 我有2个Docker容器,一个运行spring应用程序(在tomcat中),一个运行活动的mq实例。 When I try to connect to it from my spring app, I get the following error.
当我尝试从spring应用程序连接到它时,出现以下错误。 Only activeMQ is running on the one container and the port is properly exposed.
一个容器上仅运行activeMQ,并且端口正确暴露。 I verified the IP address of the docker container (shown below) and that is correct.
我验证了Docker容器的IP地址(如下所示),这是正确的。
I'm not sure what could be causing this error at this point. 我目前不确定是什么原因导致此错误。 Any thoughts would be appreciated.
任何想法将不胜感激。
ERROR [activemq.broker.BrokerService] Failed to start Apache ActiveMQ ([mybroker, ID:489af431756c-60313-1409695404227-0:1], java.io.IOException: Transport Connector could not be registered in JMX: Failed to bind to server socket: tcp://172.17.0.2:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600 due to: java.net.BindException: Cannot assign requested address)
错误[activemq.broker.BrokerService]无法启动Apache ActiveMQ([mybroker,ID:489af431756c-60313-1409695404227-0:1],java.io.IOException:无法在JMX中注册传输连接器:无法绑定到服务器套接字:tcp://172.17.0.2:61616?maximumConnections = 1000&wireFormat.maxFrameSize = 104857600由于:java.net.BindException:无法分配请求的地址)
You configured Spring to start a broker service on 172.17.0.2, which is the IP of the remote machine. 您将Spring配置为在172.17.0.2(这是远程计算机的IP)上启动代理服务。 Instead, you should configure Spring to connect to an existing broker on that machine.
相反,您应该配置Spring以连接到该计算机上的现有代理。 From the ActiveMQ documentation and using the Spring facility JMSTemplate:
从ActiveMQ文档中并使用Spring工具JMSTemplate:
<!-- a pooling based JMS provider -->
<bean id="jmsFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
destroy-method="stop">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL">
<value>tcp://activemq-host.local:61616</value>
</property>
</bean>
</property>
</bean>
<!-- Spring JMS Template -->
<bean id="myJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref local="jmsFactory"/>
</property>
</bean>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.