1 Reply Latest reply on Feb 1, 2009 2:56 AM by Dave Stanley

    Active MQ in a private network

    ar1313 Newbie

      Hello

       

      I have been unable to get ActiveMQ to work in a system with two connected networks

       

      in the this set up

       

      system A has two NICs

      NIC 0 connected to the public network

      NIC 1 connected to a private network

       

      I have configured AMQ to only listen on the private network for messages. I have posted the configuration below. When the host machine has a host name of either localhost or no host name then the configuration below allows AMQ broker to start. However if the host gets a host name from the public network then AMQ tries to resolve that hostname on the private interface and fails to start. This happens even when the transport uri is configured with the useLocalHost option.

       

      Is there some basic error i am making ? We have other Apache foundation tools ( such as Tomcat ) using this configuration successfully without a problem.  I have posted the config file and the strack trace below.  I have tried setting the broker name as well with the same result. Is there some way to disable the host resolution of AMQ ?

       

      thanks

       

       

       

         <!--

          

        • Lets deploy some Enterprise Integration Patterns inside the ActiveMQ Message Broker

          

        • For more details see

          

          

         -->

           

       

         <!--

          

        • Lets configure some Camel endpoints

          

          

         -->

       

           

       

       

       

      2009-01-27 16:42:43,439 INFO  DefaultCamelContext            - JMX enabled. Using InstrumentationLifecycleStrategy.

      2009-01-27 16:42:43,558 ERROR BrokerService                  - Failed to resolve localhost

      2009-01-27 16:42:44,592 INFO  BrokerService                  - Using Persistence Adapter: AMQPersistenceAdapter(/opt/activemq/data)

      2009-01-27 16:42:44,709 INFO  AMQPersistenceAdapter          - AMQStore starting using directory: /opt/activemq/data

      2009-01-27 16:42:44,988 INFO  KahaStore                      - Kaha Store using data directory /opt/activemq/data/kr-store/state

      2009-01-27 16:42:45,473 INFO  AMQPersistenceAdapter          - Active data files: []

      2009-01-27 16:42:45,726 INFO  BrokerService                  - ActiveMQ 5.2.0 JMS Message Broker (localhost) is starting

      2009-01-27 16:42:45,726 INFO  BrokerService                  - For help or more information please see: http://activemq.apache.org/

      2009-01-27 16:42:45,820 INFO  KahaStore                      - Kaha Store using data directory /opt/activemq/data/kr-store/data

      2009-01-27 16:42:46,126 ERROR BrokerService                  - Failed to start ActiveMQ JMS Message Broker. Reason: java.io.IOException: Transport Connector could not be registered in JMX: Failed to bind to server socket: tcp://192.168.98.101:61616?useLocalHost=true due to: java.net.UnknownHostException: test_host.test_domain: test_host.test_domain

      java.io.IOException: Transport Connector could not be registered in JMX: Failed to bind to server socket: tcp://192.168.98.101:61616?useLocalHost=true due to: java.net.UnknownHostException: test_host.test_domain: test_host.test_domain

             at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)

             at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:1434)

             at org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:1893)

             at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:1844)

             at org.apache.activemq.broker.BrokerService.start(BrokerService.java:480)

             at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:52)

             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)

             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)

             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)

             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

             at java.security.AccessController.doPrivileged(Native Method)

             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

             at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

             at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)

             at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

             at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

             at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

             at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)

             at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)

             at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)

             at org.apache.xbean.spring.context.ResourceXmlApplicationContext.(ResourceXmlApplicationContext.java:52)

             at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:96)

             at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:52)

             at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)

             at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)

             at org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:115)

             at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74)

             at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)

             at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:129)

             at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)

             at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:79)

             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

             at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

             at java.lang.reflect.Method.invoke(Unknown Source)

             at org.apache.activemq.console.Main.runTaskClass(Main.java:225)

             at org.apache.activemq.console.Main.main(Main.java:106)

             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

             at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

             at java.lang.reflect.Method.invoke(Unknown Source)

             at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)

             at java.lang.Thread.run(Unknown Source)

      Caused by: java.io.IOException: Failed to bind to server socket: tcp://192.168.98.101:61616?useLocalHost=true due to: java.net.UnknownHostException: test_host.test_domain: test_host.test_domain

             at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:33)

             at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:141)

             at org.apache.activemq.transport.tcp.TcpTransportFactory.doBind(TcpTransportFactory.java:60)

             at org.apache.activemq.transport.TransportFactory.bind(TransportFactory.java:131)

             at org.apache.activemq.broker.TransportConnector.createTransportServer(TransportConnector.java:293)

             at org.apache.activemq.broker.TransportConnector.getServer(TransportConnector.java:135)

             at org.apache.activemq.broker.TransportConnector.asManagedConnector(TransportConnector.java:98)

             at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:1428)

             ... 42 more

      Caused by: java.net.UnknownHostException: test_host.test_domain: test_host.test_domain

             at java.net.InetAddress.getLocalHost(Unknown Source)

             at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:133)

             ... 48 more

      2009-01-27 16:42:46,129 INFO  BrokerService                  - ActiveMQ Message Broker (localhost, null) is shutting down

      2009-01-27 16:42:46,129 INFO  TransportConnector             - Connector openwire Stopped

      2009-01-27 16:42:46,204 INFO  BrokerService                  - ActiveMQ JMS Message Broker (localhost, null) stopped