2017-02-22 170 views
1

我能夠使用所有用戶帳戶從Eclipse Explorer連接到MQ。但是當我嘗試從C客戶端連接到我的useraccount('muthu')時,它會引發錯誤「MQCONN以原因碼2035結束」。注意:我可以使用相同的C客戶端代碼訪問MQ,同時以root用戶(它是mqm組的一部分)運行代碼。IBM Websphere連接失敗

我目前的設置是

ALTER QMGR PSNPRES(SAFE) 
ALTER QMGR PSMODE (ENABLED) 
ALTER QMGR CHLAUTH(DISABLED) 
SET CHLAUTH(*) TYPE(BLOCKUSER) USERLIST('*NOACCESS') 
DEFINE CHANNEL(SYSTEM.ADMIN.SVRCONN) CHLTYPE(SVRCONN) MCAUSER('sampleuser') REPLACE 
ALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS) CHCKCLNT(OPTIONAL) 
REFRESH SECURITY TYPE(CONNAUTH) 

以下是AMQERR01.LOG

 ----- cmqxrsrv.c : 2363 ------------------------------------------------------- 
02/22/17 13:51:13 - Process(353.6) User(root) Program(amqrmppa) 
        Host(ec060cda2b57) Installation(Installation1) 
        VRMF(9.0.0.0) QMgr(TMVDEVQM) 

AMQ9788: Slow DNS lookup for address '172.17.0.1'. 

EXPLANATION: 
An attempt to resolve address '172.17.0.1' using the 'getnameinfo' function 
call took 20 seconds to complete. This might indicate a problem with the DNS 
configuration. 
ACTION: 
Ensure that DNS is correctly configured on the local system. 

If the address was an IP address then the slow operation was a reverse DNS 
lookup. Some DNS configurations are not capable of reverse DNS lookups and some 
IP addresses have no valid reverse DNS entries. If the problem persists, 
consider disabling reverse DNS lookups until the issue with the DNS can be 
resolved. 
----- amqcrhna.c : 794 -------------------------------------------------------- 
02/22/17 13:51:33 - Process(353.6) User(root) Program(amqrmppa) 
        Host(ec060cda2b57) Installation(Installation1) 
        VRMF(9.0.0.0) QMgr(TMVDEVQM) 

AMQ9788: Slow DNS lookup for address '172.17.0.1'. 

EXPLANATION: 
An attempt to resolve address '172.17.0.1' using the 'getnameinfo' function 
call took 20 seconds to complete. This might indicate a problem with the DNS 
configuration. 
ACTION: 
Ensure that DNS is correctly configured on the local system. 

If the address was an IP address then the slow operation was a reverse DNS 
lookup. Some DNS configurations are not capable of reverse DNS lookups and some 
IP addresses have no valid reverse DNS entries. If the problem persists, 
consider disabling reverse DNS lookups until the issue with the DNS can be 
resolved. 
----- amqcrhna.c : 794 -------------------------------------------------------- 
02/22/17 13:51:33 - Process(353.6) User(root) Program(amqrmppa) 
        Host(ec060cda2b57) Installation(Installation1) 
        VRMF(9.0.0.0) QMgr(TMVDEVQM) 

AMQ9209: Connection to host '172.17.0.1' for channel 'SYSTEM.DEF.SVRCONN' 
closed. 

EXPLANATION: 
An error occurred receiving data from '172.17.0.1' over TCP/IP. The connection 
to the remote host has unexpectedly terminated. 

The channel name is 'SYSTEM.DEF.SVRCONN'; in some cases it cannot be determined 
and so is shown as '????'. 
ACTION: 
Tell the systems administrator. 

C代碼要點找到日誌:

int pub(char *topic_name, char *queue_manager_name, char *message) 
{ 
    /* Declare file and character for sample input     */ 
    FILE *fp; 

    /* Declare MQI structures needed        */ 
    MQOD  od = {MQOD_DEFAULT}; /* Object Descriptor    */ 
    MQMD  md = {MQMD_DEFAULT}; /* Message Descriptor   */ 
    MQPMO pmo = {MQPMO_DEFAULT}; /* put message options   */ 
     /** note, sample uses defaults where it can **/ 

    MQHCONN Hcon;     /* connection handle    */ 
    MQHOBJ Hobj;     /* object handle     */ 
    MQLONG CompCode;    /* completion code    */ 
    MQLONG OpenCode;    /* MQOPEN completion code  */ 
    MQLONG Reason;     /* reason code     */ 
    MQLONG CReason;    /* reason code for MQCONN  */ 
    MQLONG messlen;    /* message length    */ 
    char  buffer[100];   /* message buffer    */ 
    char  QMName[50];    /* queue manager name   */ 

    QMName[0] = 0; /* default */ 
    strncpy(QMName, queue_manager_name, MQ_Q_MGR_NAME_LENGTH); 

    pmo.Options = MQPMO_FAIL_IF_QUIESCING 
       | MQPMO_NO_SYNCPOINT; 

    /******************************************************************/ 
    /*                */ 
    /* Connect to queue manager          */ 
    /*                */ 
    /******************************************************************/ 
    MQCONN(QMName,     /* queue manager     */ 
      &Hcon,     /* connection handle    */ 
      &CompCode,    /* completion code    */ 
      &CReason);    /* reason code     */ 

    /* report reason and stop if it failed  */ 
    if (CompCode == MQCC_FAILED) 
    { 
    printf("MQCONN ended with reason code %d\n", CReason); 
    return (int)CReason; 
    } 
................. 

任何想法。 ?

這是我的問題,從Provide anonymous access to IBM WebSphere MQ

+1

你連接了什麼c客戶端?示例應用程序之一還是您自己的?如果它是一個示例應用程序,您正在設置哪個環境變量以及哪些環境變量正在傳遞? 你已經顯示的日誌,你可以檢查你已經從隊列管理器日誌中提供了整個日誌(/ var/mqm/qmgrs/ /errors/AMQERR01.LOG),我期望看到另一條日誌消息與AMQ9557錯誤一起去。 –

+0

剛添加AMQ9557之前的日誌行。這是你指的是什麼?我正在使用安裝時附帶的示例pub/sub c程序之一,並進行了小小的調整。 – Muthukumar

+1

究竟哪個樣本pub/sub程序? amqspuba.c? amqssuba.c? 我實際上是在之前的日誌條目之後。例如,我剛剛在隊列管理器日誌中重新創建了一個AMQ9557錯誤,並且在該錯誤消息之前是另一個錯誤消息(在本例中爲AMQ8075),詳細解釋了爲什麼引發AMQ9557錯誤。 –

回答

3

繼續看你的MQSC代碼,我看你已經定義了一個通道叫做SYSTEM.ADMIN.SVRCONN不過,我在信道被稱爲SYSTEM.DEF.SVRCONN被關閉(連接失敗以下)的日誌中看到。

鑑於您發佈的示例程序未設置MQCNO結構,這是以編程方式傳遞通道名稱的方式,並且您尚未提及CCDT(這是另一種方式),我懷疑MQSERVER環境變量不正確。