java - 从 java 中捕获 MQ 错误代码

标签 java ibm-mq mq

我正在使用 IBM MQ 并在 queue 上放置一条消息,我需要捕获错误代码,例如:

MQJE001: Completion Code '2' Reason '2035'

我的问题是读取此错误代码,我的 java 程序通过以下方式读取输出:

BufferReader reader = new BufferReader(new InputStreamReader(processSH.getInputStream())); // processSH - the process that is putting message on queue

如果没有错误代码,我可以用这种方式读取输出,但我无法使用 :

String line = null;
while(line.reader.readLine()) != null){
    system.out.println(line) // prints nothing in case of error
}

感谢所有帮助者!

最佳答案

我认为问题出在这段代码中:

String line = null;
while(line.reader.readLine()) != null){
    system.out.println(line) // prints nothing in case of error
}

我什至不确定你是如何编译它的。 reader 不是 String 的属性。我认为该行应为:

while(line = reader.readLine()) != null){

关于java - 从 java 中捕获 MQ 错误代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36382464/

相关文章:

python - python 中正确的线程

ibm-mq - Websphere QM 配置 - muusr_mqadmin 帐户错误

java - 与用于 Selenium 对象模式设计的 Robot 框架的关键字管理集成

java - 使用 Graphics2D 绘制 TYPE_INT_ARGB_PRE 类型的 BufferedImage 时遇到问题

jms - 使用 CoD over Camel JMS 组件实现原生 websphere MQ

c# - 通过 C# 将消息放入 Websphere MQ 与手动放置相同的消息具有不同的数据长度

java - 浏览器中的 PIV 智能卡如何在没有小程序的情况下进行身份验证

javascript - 如何遍历选定的 HTML 表格行并从每一行中检索数据

java - 解决 IBM MQ 独立应用程序中的 MQRC 2195 错误

c - 尝试编译 C 程序时,如何解决 AIX 机器上的 undefined symbol 错误?