2017-02-22 245 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环境变量不正确。