안녕하세요, 오후에 IBM MQ에서 Park Queue Info를 가져 오는 프로젝트를 작성했습니다. 연결을 닫으려고 시도 할 때 오류가 발생했습니다. 그것은 자바로 작성되었습니다. MQ 컴퓨터의 이벤트 뷰어에서 응용 프로그램을 사용하는 경우 두 가지 오류가 표시됩니다. 그들은 :MQ 연결 닫기
"채널 프로그램이 비정상적으로 종료되었습니다. 'system.def.surconn'채널 프로그램이 비정상적으로 종료되었습니다. 오류 파일의 'system.def.surconn'채널 프로그램에 대한 이전 오류 메시지를보고 실패의 원인을 판별하십시오.
다른 메시지 상태 : 호스트 rnanaj에서 수신에 "오류 (10.10.12.34) 오류가 TCP/IP를 통해 rnanaj (10.10.12.34)에서 수신 데이터를 발생했습니다. 이는 통신 장애로 인한 것일 수 있습니다. tcp/ip recv() 호출의 리턴 코드는 10054 (X'2746 ')입니다. 이 값을 기록하십시오. "
이것은 연결 또는 연결을 닫으려는 시도입니다. 아래 코드는 연결하고 닫습니다. 아이디어가 있습니까?
연결 닫기
_logger.info("Start");
File outputFile = new File(System.getProperty("PROJECT_HOME"), "run/" + this.getClass().getSimpleName() + "." + System.getProperty("qmgr") + ".txt");
FileUtils.mkdirs(outputFile.getParentFile());
Connection jmsConn = null;
Session jmsSession = null;
QueueBrowser queueBrowser = null;
BufferedWriter commandsBw = null;
try {
// get queue connection
MQConnectionFactory MQConn = new MQConnectionFactory();
MQConn.setHostName(System.getProperty("host"));
MQConn.setPort(Integer.valueOf(System.getProperty("port")));
MQConn.setQueueManager(System.getProperty("qmgr"));
MQConn.setChannel("SYSTEM.DEF.SVRCONN");
MQConn.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
jmsConn = (Connection) MQConn.createConnection();
jmsSession = jmsConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue jmsQueue = jmsSession.createQueue("PARK");
// browse thru messages
queueBrowser = jmsSession.createBrowser(jmsQueue);
Enumeration msgEnum = queueBrowser.getEnumeration();
commandsBw = new BufferedWriter(new FileWriter(outputFile));
//
String line = "DateTime\tMsgID\tOrigMsgID\tCorrelationID\tComputerName\tSubsystem\tDispatcherName\tProcessor\tJobID\tErrorMsg";
commandsBw.write(line);
commandsBw.newLine();
while (msgEnum.hasMoreElements()) {
Message message = (Message) msgEnum.nextElement();
line = dateFormatter.format(new Date(message.getJMSTimestamp()))
+ "\t" + message.getJMSMessageID()
+ "\t" + message.getStringProperty("pkd_orig_jms_msg_id")
+ "\t" + message.getJMSCorrelationID()
+ "\t" + message.getStringProperty("pkd_computer_name")
+ "\t" + message.getStringProperty("pkd_subsystem")
+ "\t" + message.getStringProperty("pkd_dispatcher_name")
+ "\t" + message.getStringProperty("pkd_processor")
+ "\t" + message.getStringProperty("pkd_job_id")
+ "\t" + message.getStringProperty("pkd_sysex_msg");
_logger.info(line);
commandsBw.write(line);
commandsBw.newLine();
}
}
는 :
finally {
IO.close(commandsBw);
if (queueBrowser != null) { try { queueBrowser.close();} catch (Exception ignore) {}}
if (jmsSession != null) { try { jmsSession.close();} catch (Exception ignore) {}}
if (jmsConn != null) { try { jmsConn.stop();} catch (Exception ignore) {}}
}
감사합니다. 질문을 게시 한 직후에 알아 냈습니다. 재미있는 방법. – OakvilleWork
다행 이군! 답변을 수락하기 위해 돌아서 주셔서 감사합니다. –