title: Using ActiveMQ via JNDI
body: <p>I'm trying to create simply connect with ActiveMQ using JNDI. <hr/>
  I have</p>
  
  <ol>
  <li><p>Queue named 'example.A'.</p></li>
  <li><p>According <a href="http://activemq.apache.org/jndi-support.html" rel="noreferrer">ActiveMQ documentation touching JNDI</a>, if I want to use ConectionFactories and Queues (Topics) via JNDI, I have to place jndi.properties file on my classpath. As I have understood, activeMQ classpath  is %activemq%/conf directory by default. I have not changed it.
  So I have this property for my queue:</p>
  
  <p>queue.MyQueue = example.A</p></li>
  <li><p>I have created java client class for ActiveMQ which uses JNDI as below:</p>
  
  <pre><code>    Properties jndiParameters = new Properties() ;
      jndiParameters.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
      jndiParameters.put(Context.PROVIDER_URL, "tcp://localhost:61616");
      Context context = new InitialContext(jndiParameters);
      ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("ConnectionFactory");
      Queue queue = (Queue) context.lookup("MyQueue");
  </code></pre></li>
  </ol>
  
  <p>but it cannot find my queue, it throws exception: javax.naming.NameNotFoundException: MyQueue</p>
  
  <p>Where are my misstakes?</p>