title: Remote JNDI lookup using IBM MQ doesn't work
body: <p>I have installed the IBM MQ server v9 in machine A, in this MQ server, through MQ Explorer, I defined a queue manager and some queues. I want this queue manager and its queues to be looked up through JNDI from a client running on another machine B.</p>
  
  <p>Therefore, through MQ Explorer, I tried to add an initial context in "JMS Administered Objects", for the JNDI namespace located, I don't want to use LDAP server or File system, I choose "Other" option (check following image) and provide <code>com.ibm.ejs.ns.jndi.CNInitialContextFactory</code>(I also tried <code>com.ibm.websphere.naming.WsnInitialContextFactory</code>), the provided url is defined as <code>iiop://&lt;machine_A_IP&gt;:2809</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/8fjsb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8fjsb.png" alt="enter image description here"></a></p>
  
  <p>Here is the client code:</p>
  
  <pre><code>// Instantiate the initial context
  Hashtable&lt;String, String&gt; environment = new Hashtable&lt;String, String&gt;();
  environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
  environment.put(Context.PROVIDER_URL, "iiop://&lt;machine_A_IP&gt;:2809");
  Context context = new InitialDirContext(environment);
  
  // Lookup the connection factory
  JmsConnectionFactory cf = (JmsConnectionFactory) context.lookup("testConnectionFactory");
  </code></pre>
  
  <p>"testConnectionFactory" is the connection factory which is defined in the JMS administered object.</p>
  
  <p>When I run the code, I always get an error:</p>
  
  <blockquote>
    <p>javax.naming.NameNotFoundException: Name "testConnectionFactory" not found in context
    "serverlocal:CELLROOT/SERVERROOT". FAILURE</p>
  </blockquote>
  
  <h2><strong>!!!!!!!!!!!!!!!!! UPDATE !!!!!!!!!!!!!!!!!!</strong></h2>
  
  <p><strong>After some investigations, I found out that com.ibm.websphere.naming.WsnInitialContextFactory is really specific to Websphere application server. I tested directly in java Main class, probably that is why I always failed.</strong> </p>
  
  <p><strong>In my case, I really need to deploy the client to JBoss EAP 7, is there a provider I can use?</strong></p>
  
  <p>I tried to find a sample in IBM community, but everything is related to file system or LDAP server. </p>
  
  <p>Can anyone help me? Any suggestion would be appreciated!</p>
  
  <p>Thanks in advance.</p>