简体   繁体   English

连接到在Docker容器上运行的远程activemq实例

[英]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.

相关问题 使用Core API连接到ActiveMQ Artemis Docker容器 - Connecting to ActiveMQ Artemis Docker Container with Core API 将 Eclipse 连接到 Docker 容器以进行远程调试 - Connecting Eclipse to Docker Container for Remote Debugging 连接到Docker中运行的远程EJB模块 - Connecting to a Remote EJB Module running in Docker 将运行在bridge网络上的Docker Container连接到Localhost - Connecting Docker Container running on bridge network to Localhost 连接到在 docker 容器中运行的 Kafka 时出错 - Error connecting to Kafka running in docker container 如何:运行 java jar 的 Docker 容器连接到主机 mysql 服务器? - How to: Docker container running java jar connecting to host mysql server? 将运行5.8的ActiveMQ使用者与运行5.5的ActiveMQ服务器连接 - Connecting ActiveMQ consumer running 5.8 with ActiveMQ server running 5.5 如何从主机外部(同一网络)连接到在 docker 容器内运行的 activemq 代理 [Windows] - How to connect to an activemq broker which is running inside a docker container from outside the host (same network) [Windows] 如何在 Intellij 中远程调试作为 docker 容器运行的 java 应用程序 - How to Remote debug of java application running as docker container in Intellij Docker / Hibernate / PostgreSQL-将运行Hibernate / SpringBoot应用程序的容器与postgreSQL容器连接不起作用 - Docker/Hibernate/PostgreSQL - Connecting container running Hibernate/SpringBoot app with a postgreSQL container not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM