Announcement Announcement Module
Collapse
No announcement yet.
How to connect to Active MQ broker running in another Machine Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to connect to Active MQ broker running in another Machine

    Hi,
    I am trying to connect to active MQ broker which is running in a remote machine. [the configuration part is below].But i am getting the following error.How can i connect to Active MQ broker running in different machine using spring configurtion.

    java.io.IOException: Failed to bind to server socket: stomp://wendy-test.nyc.e-infoexchange.net:61613 due to: java.net.BindException: Cannot assign requested address: JVM_Bind
    at org.apache.activemq.util.IOExceptionSupport.create (IOExceptionSupport.java:31)
    at org.apache.activemq.transport.tcp.TcpTransportServ er.bind(TcpTransportServer.java:88)
    at org.apache.activemq.transport.tcp.TcpTransportFact ory.doBind(TcpTransportFactory.java:56)


    <amq:broker useJmx="false" persistent="false">
    <amq:transportConnectors>
    <amq:transportConnector uri="stomp://remoteIP:61613" />
    </amq:transportConnectors>
    </amq:broker>
    <bean id="jmsFactory" class="org.apache.activemq.pool.PooledConnectionFa ctory">
    <property name="connectionFactory">
    <bean class="org.apache.activemq.ActiveMQConnectionFacto ry" >
    <property name="brokerURL">
    <value>vm://remoeIP:61613</value>
    </property>
    </bean>
    </property>
    </bean>

  • #2
    Your config does NOT indicate that you are trying to connect to a remote JMS server; it indicates that you are trying to HOST a JMS broker, which is why you are getting a 'server bind exception'. You cannot bind a REMOTE address for a server socket.

    Comment


    • #3
      Thanks for ur reply. Normally i used vm://localhost in brokerURL of ActiveMQConnectionFactory bean. It was working fine. But when i try to connect to active MQ broker running in other machine, i am getting JVM binding error.Can plz explain me how can i configure spring to solve my requirement?.

      Comment


      • #4
        It's not a spring problem, it's an active mq configuration problem.

        I'd suggest that you RTFM....

        You are trying to create a CLIENT connection to a remote BROKER.

        http://activemq.apache.org/spring-support.html

        Comment


        • #5
          Thanks for ur reply. The link is really useful. I modified my configuration as below. Do i need to specify anything else for stomp: transport?.

          <amq:broker useJmx="false" persistent="false">
          <amq:transportConnectors>
          <amq:transportConnector uri="tcp://localhost:0" />
          </amq:transportConnectors>
          </amq:broker>

          <!-- a pooling based JMS provider -->
          <bean id="jmsFactory" class="org.apache.activemq.pool.PooledConnectionFa ctory">
          <property name="connectionFactory">
          <bean class="org.apache.activemq.ActiveMQConnectionFacto ry" >
          <property name="brokerURL">
          <value>stomp://BrokermachineIP:61613</value>
          </property>
          </bean>
          </property>
          </bean>

          Comment


          • #6
            If you are connecting to a remote mq broker, you don't need to run one on your local machine. You should NOT have an amq:broker bean defined. Just the JMS connection factory bean that connects to the remote broker.

            Comment


            • #7
              Thanks a lot. It is really a Useful instruction. I removed amq:broker.Now my config contains only jmsfactory with stomp transport. But i was not able o connect to my broker. It neither throws any exception nor connected to active mq. Is there anything i am doing wrong ?. Do i need any specific config for stomp?

              <bean id="jmsFactory" class="org.apache.activemq.pool.PooledConnectionFa ctory">
              <property name="connectionFactory">
              <bean class="org.apache.activemq.ActiveMQConnectionFacto ry" >
              <property name="brokerURL">
              <value>stomp://brokermachineIP:61613</value>
              </property>
              </bean>
              </property>
              </bean>

              Comment


              • #8
                How do you know you weren't able to connect? Do you have something that is using the connection factory (e.g. a jmstemplate)?

                And, please use the code tags when you post your xml....

                Comment


                • #9
                  Yes one of bean is using the JMSTemplate and destination to put messages in the queue.Another bean listens to the queue. Also in the log i did not see any details regarding Active MQ. When i use local broker (vm://localhost) it is working fine also I saw AciveMQ related log details and my message got passed thru MQ successfully.

                  Comment


                  • #10
                    Originally posted by PadmaPriya View Post
                    Yes one of bean is using the JMSTemplate and destination to put messages in the queue.Another bean listens to the queue. Also in the log i did not see any details regarding Active MQ. When i use local broker (vm://localhost) it is working fine also I saw AciveMQ related log details and my message got passed thru MQ successfully.
                    You're were seeing active mq related logging because the broker was running inside the local VM. Per your original post, you don't want to run a local message broker you want to connect to a remote broker. YOU WILL NOT SEE active mq broker logging anymore if you set this up correctly because you should not be running a local broker. I'm not sure how many different ways I have to say this.....

                    Comment

                    Working...
                    X