title: Exception: com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2009
body: <p>I am trying to write my test message to MQ, but failed to do so.</p>
  
  <p>Sharing the source-code and error:</p>
  
  <p><strong>source-code</strong></p>
  
  <pre><code>import com.ibm.mq.MQEnvironment;
  import com.ibm.mq.MQMessage;
  import com.ibm.mq.MQPutMessageOptions;
  import com.ibm.mq.MQQueueManager;
  import com.ibm.mq.MQQueue;
  import com.ibm.mq.MQC;
  
  public class MQResponseWriter {
  
      public static void main(String[] args) {
  
          try {
              int openOptions = MQC.MQOO_INQUIRE | MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
              MQEnvironment.hostname = "myserver_name";
              MQEnvironment.port = 1417;
              MQEnvironment.channel = "my_channel_name";
              //MQEnvironment.properties.put(CMQC.USER_ID_PROPERTY, "admin");
              //MQEnvironment.properties.put(CMQC.PASSWORD_PROPERTY, "passw0rd");          
              //MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);
              MQQueueManager queueManager;
              queueManager = new MQQueueManager("queue_manger_name");
              MQQueue destQueue = queueManager.accessQueue("queue_name", openOptions);
              MQMessage hello_world = new MQMessage();
              hello_world.writeUTF("Blah...blah...bleah...test message no.1...!");
              MQPutMessageOptions pmo = new MQPutMessageOptions();
              destQueue.put(hello_world, pmo);
              destQueue.close();
              queueManager.disconnect();
              System.out.println("------------------------success...");            
          } catch (Exception e) {
              System.out.println("Exception: " + e);
              e.printStackTrace();
          }
  
      }
  
  }
  </code></pre>
  
  <p><strong>error message</strong></p>
  
  <pre><code>MQJE001: An MQException occurred: Completion Code 2, Reason 2195
  MQJE007: IO error reading message data
  Error occured during API call - reason code0
  MQJE001: Completion Code 2, Reason 2009
  MQJE001: Completion Code 2, Reason 2018
  Exception: com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2009
  com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2009
      at com.ibm.mq.MQQueueManager.&lt;init&gt;(MQQueueManager.java:922)
      at com.ibm.mq.MQManagedConnectionJ11.getConnection(MQManagedConnectionJ11.java:426)
      at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:180)
      at com.ibm.mq.MQQueueManager.obtainBaseMQQueueManager(MQQueueManager.java:771)
      at com.ibm.mq.MQQueueManager.construct(MQQueueManager.java:705)
      at com.ibm.mq.MQQueueManager.&lt;init&gt;(MQQueueManager.java:434)
      at com.module.main.MQResponseWriter.main(MQResponseWriter.java:24)
  </code></pre>
  
  <p>What might be main cause of above error and solution if any??</p>