title: Cannot start the broker and Failed to start Apache ActiveMQ
body: <p>I am using ActiveMQ to send messages between my server and client.</p>
  
  <p>The following is my client side code:</p>
  
  <pre><code>public String sendMessage() {
      try {
          ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://xxx.xxx.xxx.xx:61616");
          Connection connection = connectionFactory.createConnection();
          connection.start();
          Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
          Destination queue = session.createQueue("Test");
          MessageProducer producer = session.createProducer(queue);
          TextMessage msg = session.createTextMessage();
          msg.setText("This is a test message");
          producer.send(msg);
  
          producer.close();
          session.close();
          connection.close();
  
      } catch (Exception e) {
          System.out.println("Caught: " + e);
          e.printStackTrace();
          return "ERROR";
      }
      return "SUCCESS";
  }
  </code></pre>
  
  <p>Server Side Code:</p>
  
  <pre><code>        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://xxx.xxx.xxx.xx:61616");
          Connection connection = connectionFactory.createConnection();
          connection.start();
          Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
          Destination queue = session.createQueue("Test");
          MessageConsumer consumer = session.createConsumer(queue);
          Message message = consumer.receive(1000);
  
          if(message instanceof TextMessage) {
              TextMessage textMessage = (TextMessage) message;
              String text = textMessage.getText();
              System.out.println("Received: " + text);
          } else {
              System.out.println("Received: " + message);
          }
  
          consumer.close();
          session.close();
          connection.close();
  </code></pre>
  
  <p>I got this following error:</p>
  
  <p>| ERROR | ctivemq.server]) | BrokerService                    | 324 - org.apache.activemq.activemq-osgi - 5.14.0.SNAPSHOT | Failed to start Apache ActiveMQ ([amq-broker, ID:activemq-56232-1449101341819-0:1], java.io.IOException: Transport Connector could not be registered in JMX: java.io.IOException: Failed to bind to server socket: tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600 due to: java.net.BindException: Address already in use)</p>
  
  <p>| ERROR | ctivemq.server]) | configadmin                      | 6 - org.apache.felix.configadmin - 1.8.4 | [org.osgi.service.cm.ManagedServiceFactory, id=826, bundle=324/mvn:org.apache.activemq/activemq-osgi/5.14-SNAPSHOT]: Updating configuration org.apache.activemq.server.589ab8cb-ee75-4f36-9ffe-d2c04494cf99 caused a problem: Cannot start the broker
  org.osgi.service.cm.ConfigurationException: null : Cannot start the broker
          at org.apache.activemq.osgi.ActiveMQServiceFactory.updated(ActiveMQServiceFactory.java:120)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at Proxy813ac29d_d0c7_49be_8132_e25aaca29f9e.updated(Unknown Source)[:]
          at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159)[6:org.apache.felix.configadmin:1.8.4]
          at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93)[6:org.apache.felix.configadmin:1.8.4]
          at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.provide(ConfigurationManager.java:1597)[6:org.apache.felix.configadmin:1.8.4]
          at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.run(ConfigurationManager.java:1540)[6:org.apache.felix.configadmin:1.8.4]
          at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:103)[6:org.apache.felix.configadmin:1.8.4]
          at java.lang.Thread.run(Thread.java:745)[:1.7.0_80]
  Caused by: java.io.IOException: Transport Connector could not be registered in JMX: java.io.IOException: Failed to bind to server socket: tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600 due to: java.net.BindException: Address already in use
          at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:2193)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:2652)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:2569)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.broker.BrokerService.doStartBroker(BrokerService.java:737)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.broker.BrokerService.startBroker(BrokerService.java:697)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.broker.BrokerService.start(BrokerService.java:618)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.osgi.ActiveMQServiceFactory.updated(ActiveMQServiceFactory.java:116)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          ... 7 more
  Caused by: java.io.IOException: Failed to bind to server socket: tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600 due to: java.net.BindException: Address already in use
          at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:33)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:140)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.transport.tcp.TcpTransportFactory.doBind(TcpTransportFactory.java:62)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.transport.TransportFactorySupport.bind(TransportFactorySupport.java:40)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.broker.TransportConnector.createTransportServer(TransportConnector.java:315)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.broker.TransportConnector.getServer(TransportConnector.java:141)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.broker.TransportConnector.asManagedConnector(TransportConnector.java:107)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:2188)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          ... 13 more
  Caused by: java.net.BindException: Address already in use
          at java.net.PlainSocketImpl.socketBind(Native Method)[:1.7.0_80]
          at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)[:1.7.0_80]
          at java.net.ServerSocket.bind(ServerSocket.java:376)[:1.7.0_80]
          at java.net.ServerSocket.(ServerSocket.java:237)[:1.7.0_80]
          at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231)[:1.7.0_80]
          at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:137)[324:org.apache.activemq.activemq-osgi:5.14.0.SNAPSHOT]
          ... 19 more
  2015-12-02 16:09:02,728 | ERROR | ctivemq.server]) | configadmin                      | 6 - org.apache.felix.configadmin - 1.8.4 | Cannot use configuration org.apache.activemq.server.589ab8cb-ee75-4f36-9ffe-d2c04494cf99 for [org.osgi.service.cm.ManagedServiceFactory, id=829, bundle=411/mvn:org.apache.activemq/activemq-osgi/5.11.1]: No visibility to configuration bound to mvn:org.apache.activemq/activemq-osgi/5.14-SNAPSHOT</p>
  
  <p>The messages are produced but at server side I got this error. I tried killing previous instance and starting a new one. I am using Ubuntu 14.04.</p>
  
  <p>Please help me to resolve this.</p>
  
  <p>Thank you all in advance.</p>