The code below does file transfer. I am successful in putting a file into a queue. I can also grab the file from the queue. However in the GET FILE section I am getting the error saying that the path does not exist. The problem is with the retrievedMessage.putApplicationName specified in the path. How do I solve the problem?.Code:PUT FILE qMgr = new MQQueueManager(qManager); int openOptions = MQC.MQOO_OUTPUT ; MQQueue MQ1_RQSTIN = qMgr.accessQueue("QM1.RQSTIN",openOptions); MQMessage hello_world = new MQMessage(); hello_world.putApplicationName = "src_mqsample.txt"; File file = new File("C:\\Documents and Settings\\JCreatorLE\\src_mqsample.txt"); StringBuffer contents = new StringBuffer(); BufferedReader reader = null; reader = new BufferedReader(new FileReader(file)); String text = null; while((text = reader.readLine())!= null) { contents.append(text).append(System.getProperty("line.separator")); } MQPutMessageOptions pmo = new MQPutMessageOptions(); MQ1_RQSTIN.put(hello_world,pmo); hello_world.writeObject(contents); MQPutMessageOptions pmo = new MQPutMessageOptions(); MQ1_RQSTIN.put(hello_world,pmo); MQ1_RQSTIN.close(); qMgr.disconnect(); GET FILE qMgr = new MQQueueManager("QM5"); int openOptions = MQC.MQOO_INPUT_AS_Q_DEF ; MQQueue MQ1_RQSTIN = qMgr.accessQueue("QM1.RQSTIN",openOptions); MQMessage retrievedMessage = new MQMessage(); MQGetMessageOptions gmo = new MQGetMessageOptions(); MQ1_RQSTIN.get(retrievedMessage,gmo); StringBuffer msg = (StringBuffer) retrievedMessage.readObject(); FileWriter fn = new FileWriter("C:\\Documents and Settings\\JCreator LE\\MyProjects\\" + "'" + retrievedMessage.putApplicationName + "'"); fn.write(msg.toString(),0,msg.toString().length()); fn.flush(); fn.close(); MQ1_RQSTIN.close(); qMgr.disconnect();


Reply With Quote



Bookmarks