我使用的是IBM版本7.5 (试用版)
我创建了两个队列管理器(QM1和QM2)
在QM1:下
港口: 1421
队列:q1(本地队列)
频道: ch1 (接收机)
在QM2:下
港口:1422
队列:Q2(传输队列),q3(远程队列)
频道:CH1(发件人)
我可以通过QM2的队列q3向QM1的队列q1发送消息。我还可以通过q2接收和浏览消息。
但是,当我使用java从q1读取消息时,会出现一个错误。
MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009
MQJE001: Completion Code 2, Reason 2009
当我查看IBM站点时,他们说这可能会导致以下原因
http://www-01.ibm.com/support/docview.wss?uid=swg21226703
但在我的系统中,以上所有的一切看起来都很不错。我错过了什么,请告诉我。
public static void main(String[] args) throws MQException {
MQEnvironment.hostname="localhost";
MQEnvironment.channel="ch1";
MQEnvironment.port=1421;
MQQueueManager qMgr= new MQQueueManager("QM1");
MQQueue outputQueue =qMgr.accessQueue("q1", MQC.MQOO_INQUIRE | MQC.MQOO_BROWSE | MQC.MQOO_INPUT_AS_Q_DEF);
//Checking for messages in queue
int i=outputQueue.getCurrentDepth();
System.out.println("Number of messages in queue: "+i);
outputQueue.close();
qMgr.close();
qMgr.disconnect();
}
增加:
jar的版本:
C:\Program (X86)\IBM\ MQ\java\lib>java MQ\java\lib>java -cp ./com.ibm.mq.jar com.ibm.mq.MQJavaLevel
名称: WebSphere MQ类
版本: 7.5.0.2
等级:P 750-002-130627
建造类型:生产
更改通道后,我收到以下错误
----- amqrmrsa.c : 898 --------------------------------------------------------
10/20/2017 02:17:37 - Process(16340.40) User(MUSR_MQADMIN) Program(amqrmppa.exe)
Host(user1) Installation(Installation1)
VRMF(7.5.0.2) QMgr(Receiver)
AMQ9777: Channel was blocked
EXPLANATION:
The inbound channel 'SYSTEM.DEF.SVRCONN' was blocked from address '127.0.0.1'
because the active values of the channel matched a record configured with
USERSRC(NOACCESS). The active values of the channel were 'CLNTUSER(fresher)'.
ACTION:
Contact the systems administrator, who should examine the channel
authentication records to ensure that the correct settings have been
configured. The ALTER QMGR CHLAUTH switch is used to control whether channel
authentication records are used. The command DISPLAY CHLAUTH can be used to
query the channel authentication records.
----- cmqxrmsa.c : 926 --------------------------------------------------------
10/20/2017 02:17:37 - Process(16340.40) User(MUSR_MQADMIN) Program(amqrmppa.exe)
Host(user1) Installation(Installation1)
VRMF(7.5.0.2) QMgr(Receiver)
AMQ9999: Channel 'SYSTEM.DEF.SVRCONN' to host 'user1 (127.0.0.1)' ended
abnormally.
EXPLANATION:
The channel program running under process ID 16340(5348) for channel
'SYSTEM.DEF.SVRCONN' ended abnormally. The host name is 'user1
(127.0.0.1)'; in some cases the host name cannot be determined and so is shown
as '????'.
ACTION:
Look at previous error messages for the channel program in the error logs to
determine the cause of the failure. Note that this message can be excluded
completely or suppressed by tuning the "ExcludeMessage" or "SuppressMessage"
attributes under the "QMErrorLog" stanza in qm.ini. Further information can be
found in the System Administration Guide.
----- amqrmrsa.c : 898 --------------------------------------------------------
发布于 2017-10-16 08:22:14
频道: ch1 (接收机) MQEnvironment.channel="ch1";
MQ客户端应用程序不能使用接收方通道连接到队列管理器。应用程序需要连接到SVRCONN通道。
其次,为MQ对象使用小写名称是个坏主意。MQ将自动大写名称,这些名称不在引号中。因此,为了避免问题,请使用大写名称。
发布于 2017-10-24 08:59:31
最后我解决了这个问题。
通过遵循上述方法,我可以解决这个问题。现在,我可以从Java应用程序读取消息。
https://stackoverflow.com/questions/46770240
复制相似问题