title: Remote Sender and Consumer JMS using HTTP in Wildfly 8.2
body: <p>I can not make it work even in http.</p>
  
  <p>I followed all the documentation I found on the websites of Wildfly and HornetQ.</p>
  
  <p>I configured standalone.xml as more important excerpts below:</p>
  
  <pre><code>&lt;subsystem xmlns="urn:jboss:domain:messaging:2.0"&gt;
      &lt;hornetq-server&gt;
          &lt;journal-file-size&gt;102400&lt;/journal-file-size&gt;
          &lt;connectors&gt;
              &lt;http-connector name="http-connector" socket-binding="http"&gt;
                  &lt;param key="http-upgrade-endpoint" value="http-acceptor"/&gt;
              &lt;/http-connector&gt;
              &lt;http-connector name="http-connector-throughput" socket-binding="http"&gt;
                  &lt;param key="http-upgrade-endpoint" value="http-acceptor-throughput"/&gt;
                  &lt;param key="batch-delay" value="50"/&gt;
              &lt;/http-connector&gt;
          &lt;/connectors&gt;
  
          &lt;acceptors&gt;
              &lt;http-acceptor http-listener="default" name="http-acceptor"/&gt;
              &lt;http-acceptor http-listener="default" name="http-acceptor-throughput"&gt;
                  &lt;param key="batch-delay" value="50"/&gt;
                  &lt;param key="direct-deliver" value="false"/&gt;
              &lt;/http-acceptor&gt;          
          &lt;/acceptors&gt;
  
          &lt;security-settings&gt;
              &lt;security-setting match="#"&gt;
                  &lt;permission type="send" roles="JMSRole"/&gt;
                  &lt;permission type="consume" roles="JMSRole"/&gt;
                  &lt;permission type="createNonDurableQueue" roles="JMSRole"/&gt;
                  &lt;permission type="deleteNonDurableQueue" roles="JMSRole"/&gt;
              &lt;/security-setting&gt;
          &lt;/security-settings&gt;
          &lt;jms-connection-factories&gt;
              &lt;connection-factory name="RemoteConnectionFactory"&gt;
                  &lt;connectors&gt;
                      &lt;connector-ref connector-name="http-connector"/&gt;
                  &lt;/connectors&gt;
                  &lt;entries&gt;
                      &lt;entry name="java:jboss/exported/jms/RemoteConnectionFactory"/&gt;
                  &lt;/entries&gt;
                  &lt;ha&gt;true&lt;/ha&gt;
                  &lt;block-on-acknowledge&gt;true&lt;/block-on-acknowledge&gt;
                  &lt;retry-interval&gt;1000&lt;/retry-interval&gt;
                  &lt;retry-interval-multiplier&gt;1.0&lt;/retry-interval-multiplier&gt;
                  &lt;reconnect-attempts&gt;-1&lt;/reconnect-attempts&gt;
              &lt;/connection-factory&gt;
          &lt;/jms-connection-factories&gt;
          &lt;jms-destinations&gt;
              &lt;jms-queue name="JMSOrderDownloadPage"&gt;
                  &lt;entry name="java:/jms/queue/JMSOrderDownloadPage"/&gt;
                  &lt;durable&gt;true&lt;/durable&gt;
                  &lt;entry name="java:jboss/exported/jms/queue/JMSOrderDownloadPage"/&gt;
              &lt;/jms-queue&gt;
              &lt;jms-queue name="DLQ"&gt;
                  &lt;entry name="java:/jms/queue/DLQ"/&gt;
                  &lt;durable&gt;true&lt;/durable&gt;
              &lt;/jms-queue&gt;
          &lt;/jms-destinations&gt;
      &lt;/hornetq-server&gt;
  &lt;/subsystem&gt;
  </code></pre>
  
  <p>I tried running the code below. Everything works correctly yet I ask the connectionFactory to create a new connection.</p>
  
  <pre><code>   HornetQConnectionFactory connectionFactory = null;
      Connection connection = null;
      Session session = null;
      MessageProducer producer = null;
      MessageConsumer consumer = null;
      Destination destination = null;
      TextMessage message = null;
      Context context = null;
  
      try {
          // Set up the context for the JNDI lookup
          final Properties env = new Properties();
          env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
          env.put(Context.PROVIDER_URL, "http-remoting://www.xyz.com:8080");
          env.put(Context.SECURITY_PRINCIPAL, "jmsuser");
          env.put(Context.SECURITY_CREDENTIALS, "pass1");
          env.put("jboss.naming.client.ejb.context", true);
          context = new InitialContext(env);
  
          connectionFactory = (HornetQConnectionFactory) context.lookup("jms/RemoteConnectionFactory"); //The lockup function correctly. Including authentication.
          destination = (Destination) context.lookup("java:/jms/queue/JMSOrderDownloadPage");
          connection = connectionFactory.createConnection("jmsuser", "pass1"); //At this time the error occurs following below, after the code.
          session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
          producer = session.createProducer(destination);
          connection.start();
          int count = Integer.parseInt("1");
          String content = System.getProperty("message.content", "Hello, World!");
          for (int i = 0; i &lt; count; i++) {
              message = session.createTextMessage(content);
              producer.send(message);
          }
      } catch (Exception e) {
        e.printStackTrace();
    }
  </code></pre>
  
  <p>The StackTrace is:</p>
  
  <p>javax.jms.JMSException: Failed to create session factory   at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:673) at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:112) at br.com.voelivre.finder.queue.search.alert.Start.main(Start.java:106) <strong>Caused by: HornetQNotConnectedException[errorType=NOT_CONNECTED message=HQ119007: Cannot connect to server(s). Tried with all available servers.]</strong>   at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:905) at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:669) ... 2 more</p>
  
  <p>I really appreciate any help.</p>