I need to create a producer and consumer of IBM MQ using the binding file. The producer is working fine, but I am facing issues with the consumer. I am getting NullPointerException while consuming data from IBM MQ using binding file in java. Below is my code:
  try {
            String MYCF_LOOKUP_NAME = "file:C:/IBM MQ/JDA-client-jars/JDA-client-jars/JDA_TEST";
            Hashtable hashtableEnvironment = new Hashtable();
            hashtableEnvironment.put(Context.INITIAL_CONTEXT_FACTORY,
                    "com.sun.jndi.fscontext.RefFSContextFactory");
            hashtableEnvironment
                    .put(
                            Context.PROVIDER_URL,
                            "file:C:/IBM MQ/JDA-client-jars/JDA-client-jars");
            InitialContext initialContext = new InitialContext(hashtableEnvironment);
            MQQueueConnectionFactory cf = (MQQueueConnectionFactory) initialContext
                    .lookup(MYCF_LOOKUP_NAME);      
            MQConnection connection = (MQConnection) cf.createConnection("SVCtestmq2","***********");
            Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
            MQQueue queue = (MQQueue) initialContext.lookup("TESTQ.FOR.JDA");      
            MQMessageConsumer consumer = (MQMessageConsumer) session.createConsumer(queue);
            Message str = consumer.receive(10000);        
            connection.close();
            initialContext.close();
        } catch (NamingException namingexception) {
            namingexception.printStackTrace();
        }
Below is the exception I am getting:
java.lang.NullPointerException
    at com.sams.logistics.jndi.jndiContext.HelloWorldMessageJNDI(jndiContext.java:79)
    at com.sams.logistics.jndi.jndiContext.main(jndiContext.java:25)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
