title: Cannot find ConnectionFactory with JNDI on JMS
body: <p>I'm new to JMS , and I'm trying to load a connectionFactory. I followed a couple of tutorials , but for some reason it doesn't seem to work , I get an exception every time I try to '.lookup' connectionfactory.
  I'm using JBoss7.1.    </p>
  
  <p>Here is the class from where I'm trying to get the connectionFactory:</p>
  
  <pre><code>public class QueueSend extends Frame implements ActionListener {  
  
    private QueueConnectionFactory qconFactory;
    private QueueConnection qcon;
    private QueueSession qsession;
    private QueueSender qsender;
    private Queue queue;
    private TextMessage msg;
  
    private TextField tf=new TextField();
    private Button send=new Button("Send");
  
    public QueueSend(){
        super("Queue Sender");
        setLocation(150,50);
        setSize(200,100);
        add(tf);
        add(send,BorderLayout.SOUTH);
        send.addActionListener(this);
        send.setEnabled(false);
        addWindowListener(new WindowAdapter(){
                            public void windowClosing(WindowEvent w){
                                send("quit");
                                close();
                                System.exit(0);
                            }
        });
        setVisible(true);
        init();
    }
  
    public void init(){
      try{
  
          InitialContext ctx = getInitialContext();
          qconFactory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
  
          queue = (Queue) ctx.lookup("java:/queue/text");
  
      qcon = qconFactory.createQueueConnection();
  
      qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
  
      qsender = qsession.createSender(queue);
  
      qcon.start();
  
      send.setEnabled(true);
  }catch(NamingException e1){e1.printStackTrace();
  }catch(JMSException e2){e2.printStackTrace();}
    }
  
  
    public void actionPerformed(ActionEvent e){
    String message=tf.getText();
    tf.setText("");
    if(message.length()&gt;0)
        send(message);
    }
  
    public void send(String message){
  try{
      //send a message with the given string
      TextMessage textMessage = qsession.createTextMessage(message);
      qsender.send(textMessage);
      // enter text here    
  }catch(JMSException e){e.printStackTrace();}
    }
  
    public void close(){
  try{
      qsender.close();
      qsession.close();
      qcon.close();
  }catch(JMSException e1){e1.printStackTrace();
  }catch(NullPointerException e2){e2.printStackTrace();}
    }
  
    public static void main(String[] args){
     new QueueSend();    
    }  
  
    public  InitialContext getInitialContext(){
      Properties properties = new Properties();
      properties.put(Context.URL_PKG_PREFIXES,"org.jboss.ejb.client.naming");
      properties.put(Context.INITIAL_CONTEXT_FACTORY,     "org.jboss.naming.remote.client.InitialContextFactory");
          properties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT",     "false");
      properties.put("java.naming.provider.url","remote://127.0.0.1:4447");
      properties.put("jboss.naming.client.ejb.context","true");
          properties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT","false"    );
  
  
  
      try {
          return new InitialContext(properties);
      } catch (NamingException e) {
          System.out.println("Cannot generate InitialContext");
          e.printStackTrace();
      }
      return null;
     }
  }
  </code></pre>
  
  <p>I get this exception:</p>
  
  <pre><code>javax.naming.NameNotFoundException: ConnectionFactory -- service   jboss.naming.context.java.jboss.exported.ConnectionFactory
  at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
  at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)
  at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:127)
  at  org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.j ava:73)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>When i log into JBoss server from the browser , I can't find 'ConnectionFactory' under the 'naming' tab</p>
  
  <p>this is from the standalone-full.xml:</p>
  
  <pre><code>            &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;
  </code></pre>
  
  <p>What am i doing wrong ?</p>