title: What should I do to connect to remote jms queue?
body: <p>I have working <strong>JBoss AS 7 (7.1.1 final)</strong> server on localhost with some queue.</p>
  
  <p>And I want to connect to that queue in a desktop application.</p>
  
  <p>So I wrote something like this:</p>
  
  <pre><code>Hashtable env = new Hashtable();
  env.put(Context.PROVIDER_URL, "remote://localhost:4447");
  env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
  InitialContext initialContext = new InitialContext(env);
  ConnectionFactory connectionFactory = (ConnectionFactory) 
  initialContext.lookup("RemoteConnectionFactory"); // &lt;- there is it fail
  </code></pre>
  
  <p>But it results in this exception:</p>
  
  <blockquote>
    <p>Exception in thread "main" javax.naming.CommunicationException: Could
    not obtain connection to any of these urls: remote://localhost:4447
    and discovery failed with error: javax.naming.CommunicationException:
    Receive timed out [Root exception is java.net.SocketTimeoutException:
    Receive timed out] [Root exception is
    javax.naming.CommunicationException: Failed to connect to server
    remote:1099 [Root exception is
    javax.naming.ServiceUnavailableException: Failed to connect to server
    remote:1099 [Root exception is java.net.UnknownHostException:
    remote]]]</p>
  </blockquote>
  
  <p>Of course, I have <strong>jbosscall-client.jar</strong> in class path.</p>