title: Standalone Java JMS app not connecting to WebSphere MQ
body: <p>I have a test app that I wrote to send and receive messages across Apache ActiveMQ using JMS.  It's only  a test app so I hard-coded the initial context factory and provider url into a Properties object then put that into an initial context:</p>
  
  <pre><code>Properties properties = new Properties();
  properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
  properties.setProperty(Context.PROVIDER_URL, providerUrl);
  InitialContext jndiContext = new InitialContext(properties);
  </code></pre>
  
  <p>And it worked.</p>
  
  <p>Having done that, I now need to convert it to use WebSphere MQ.  I don't have local access to a WebSphere MQ server, for that I need to port it to a third-party machine so I'm working a little blind to get it running locally.</p>
  
  <p>I thought that if I downloaded the client and included the jars in the class path, changed the initial context factory and provider url values, then the app would run, but not connect:</p>
  
  <pre><code>Properties properties = new Properties();
  properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
  properties.setProperty(Context.PROVIDER_URL, providerUrl);
  InitialContext jndiContext = new InitialContext(properties);
  </code></pre>
  
  <p>But it doesn't.  I get a naming exception:</p>
  
  <blockquote>
    <p>"Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory"</p>
  </blockquote>
  
  <p>I also tried "com.ibm.mq.jms.context.WMQInitialContextFactory" with the same result.</p>
  
  <p>I'd like to know the magic string to get this running, or if more fundamental changes are needed, an example of what I need to do.  Thanks.</p>