title: jboss 7.1.1 final configuration for jndi
body: <p>I missed configured JBoss AS 7.1.1 standlone.xml for JMS queues service.</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;subsystem xmlns="urn:jboss:domain:messaging:1.1"&gt;
      &lt;hornetq-server&gt;
          &lt;persistence-enabled&gt;true&lt;/persistence-enabled&gt;
          &lt;journal-file-size&gt;102400&lt;/journal-file-size&gt;
          &lt;journal-min-files&gt;2&lt;/journal-min-files&gt;
          &lt;security-enabled&gt;false&lt;/security-enabled&gt;
          &lt;connectors&gt;
              &lt;netty-connector name="netty" socket-binding="messaging"/&gt;
              &lt;netty-connector name="netty-throughput" socket-binding="messaging-throughput"&gt;
                  &lt;param key="batch-delay" value="50"/&gt;
              &lt;/netty-connector&gt;
              &lt;in-vm-connector name="in-vm" server-id="0"/&gt;
          &lt;/connectors&gt;
          &lt;acceptors&gt;
              &lt;netty-acceptor name="netty" socket-binding="messaging"/&gt;
              &lt;netty-acceptor name="netty-throughput" socket-binding="messaging-throughput"&gt;
                  &lt;param key="batch-delay" value="50"/&gt;
                  &lt;param key="direct-deliver" value="false"/&gt;
              &lt;/netty-acceptor&gt;
              &lt;in-vm-acceptor name="in-vm" server-id="0"/&gt;
          &lt;/acceptors&gt;
          &lt;security-settings&gt;
              &lt;security-setting match="#"&gt;
                  &lt;permission type="send" roles="guest"/&gt;
                  &lt;permission type="consume" roles="guest"/&gt;
                  &lt;permission type="createNonDurableQueue" roles="guest"/&gt;
                  &lt;permission type="deleteNonDurableQueue" roles="guest"/&gt;
              &lt;/security-setting&gt;
          &lt;/security-settings&gt;
          &lt;address-settings&gt;
              &lt;address-setting match="#"&gt;
                  &lt;dead-letter-address&gt;jms.queue.DLQ&lt;/dead-letter-address&gt;
                  &lt;expiry-address&gt;jms.queue.ExpiryQueue&lt;/expiry-address&gt;
                  &lt;redelivery-delay&gt;0&lt;/redelivery-delay&gt;
                  &lt;max-size-bytes&gt;10485760&lt;/max-size-bytes&gt;
                  &lt;address-full-policy&gt;BLOCK&lt;/address-full-policy&gt;
                  &lt;message-counter-history-day-limit&gt;10&lt;/message-counter-history-day-limit&gt;
              &lt;/address-setting&gt;
          &lt;/address-settings&gt;
          &lt;jms-connection-factories&gt;
              &lt;connection-factory name="InVmConnectionFactory"&gt;
                  &lt;connectors&gt;
                      &lt;connector-ref connector-name="in-vm"/&gt;
                  &lt;/connectors&gt;
                  &lt;entries&gt;
                      &lt;entry name="java:/ConnectionFactory"/&gt;
                  &lt;/entries&gt;
              &lt;/connection-factory&gt;
              &lt;connection-factory name="RemoteConnectionFactory"&gt;
                  &lt;connectors&gt;
                      &lt;connector-ref connector-name="netty"/&gt;
                  &lt;/connectors&gt;
                  &lt;entries&gt;
                      &lt;entry name="RemoteConnectionFactory"/&gt;
                      &lt;entry name="java:jboss/exported/jms/RemoteConnectionFactory"/&gt;
                  &lt;/entries&gt;
              &lt;/connection-factory&gt;
              &lt;pooled-connection-factory name="hornetq-ra"&gt;
                  &lt;transaction mode="xa"/&gt;
                  &lt;connectors&gt;
                      &lt;connector-ref connector-name="in-vm"/&gt;
                  &lt;/connectors&gt;
                  &lt;entries&gt;
                      &lt;entry name="java:/JmsXA"/&gt;
                  &lt;/entries&gt;
              &lt;/pooled-connection-factory&gt;
          &lt;/jms-connection-factories&gt;
          &lt;jms-destinations&gt;
              &lt;jms-queue name="testQueue"&gt;
                  &lt;entry name="queue/MyQueue"/&gt;
              &lt;/jms-queue&gt;
              &lt;jms-topic name="testTopic"&gt;
                  &lt;entry name="topic/MyTopic"/&gt;
              &lt;/jms-topic&gt;
          &lt;/jms-destinations&gt;
      &lt;/hornetq-server&gt;
  &lt;/subsystem&gt;
  </code></pre>
  
  <p>My properties code used in Java for sending queue message</p>
  
  <pre class="lang-java prettyprint-override"><code>Properties props = new Properties();
  props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
  props.put(Context.PROVIDER_URL, "remote://localhost:4447");
  props.put(Context.SECURITY_PRINCIPAL, "user");
  props.put(Context.SECURITY_CREDENTIALS, "pass");
  </code></pre>
  
  <p>// user/pass is ManagementRealm's usrname/passwords</p>
  
  <p>I used Java code for send message of queue and before coding I testing for properties JNDI lookup connections.</p>
  
  <pre class="lang-java prettyprint-override"><code>InitialContext initialContext = new InitialContext(props);
  // Context initialContext=new InitialContext(props);
  ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("jms/RemoteConnectionFactory");
  System.out.println("connection success");
  </code></pre>
  
  <p>I did not get connection i did not get any errors also.</p>
  
  <p>If i used below properties then i did get error is </p>
  
  <pre><code>Exception in thread "main" javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]........etc
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
  props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
  props.setProperty("java.naming.provider.url", "remote://localhost:4447");
  </code></pre>
  
  <p>Any suggestions or any other ideas am Googleing  also. Please save my days or any mi stacks in my code.and am using spring 3.0.1.</p>