我使用IBM MQ 7.5版本(試用版)閱讀IBM MQ消息我不能用java
我創建了兩個隊列管理器(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
- 防火牆已終止連接。
- IOException導致套接字被關閉。
- 顯式操作導致套接字被一端關閉。
- 隊列管理器處於脫機狀態。
- 隊列管理器允許的最大通道數已打開。
- 隊列連接工廠(QCF)中的配置問題。
但是,以上所有都在我的系統中看起來不錯。我想念的是什麼,請讓我知道。
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 Files文件(x86)的\ IBM \ WebSphere MQ的\ java的\ LIB> java命令./com.ibm.mq .jar com.ibm.mq.MQJavaLevel
名稱:用於Java的WebSphere MQ類
版本:7.5.0。2
程度:p750-002-130627
生成類型:CH1(接收機)
MQEnvironment:生產
改變頻道已經收到的下面誤差
----- 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 --------------------------------------------------------
您應該查看QM1隊列管理器的AMQERR01.LOG,以查看客戶端獲得2009年時記錄的錯誤。請單擊編輯並使用這些詳細信息更新您的問題。另請提供您正在使用的MQ服務器的完整版本以及您的IBM MQ jar文件所來源的MQ的完整版本(如果它們不相同)。 – JoshMc
你解決了你的問題嗎? – JoshMc
還沒有,我嘗試按照@Roger的建議來使用svrconn頻道,但我無法做到。如果我在該類型中創建一個頻道,它不會啓動,所以我現在嘗試啓動channle的這種類型(svrconn)。 – Fresher