1

I am able to connect to the MQ from Eclipse Explorer with all user accounts. But when I try to connect from a C Client with my useraccount ('muthu') it throws the error "MQCONN ended with reason code 2035". Note: I am able to access the MQ using the same C-Client code while running the code as a root user(which is part of mqm group).

My current setup is

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)

Following is the log found in 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-Code gist :

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;
   }
.................

Any thoughts. ?

This a continuation of my issue from Provide anonymous access to IBM WebSphere MQ

Community
  • 1
  • 1
Muthukumar
  • 8,679
  • 17
  • 61
  • 86
  • 1
    What c client are you connecting with? One of the sample applications or your own? If it is a sample application, which one and what environment variables are you setting/parameters are you passing? The log you have shown, can you just check you've given the whole log from the queue manager log (/var/mqm/qmgrs//errors/AMQERR01.LOG) I would of expected to see one more log message to go with the AMQ9557 error. – Rob Parker Feb 22 '17 at 12:17
  • Just added the line from the log preceding to AMQ9557. Is that what you are referring to ? I am using one of the sample pub/sub c-programs which came with the installation, with minor tweaks. – Muthukumar Feb 22 '17 at 12:31
  • 1
    Which Sample pub/sub program exactly? amqspuba.c? amqssuba.c? I was actually after the previous log entry. For example i just quickly recreated a AMQ9557 error in my Queue Manager logs and before that error message is another error message (in my case AMQ8075) that details why the AMQ9557 error was thrown. – Rob Parker Feb 22 '17 at 12:43
  • I don't see an entry for AMQ8075. I ran the test gain. I have updated the new logs. The primary error seems to be "The call to initialize the User ID 'sampleuser' failed with CompCode 2 and Reason 2035.", The rest of the errors shown in the log are written few seconds later. I am using amqspuba.c to test now. – Muthukumar Feb 22 '17 at 12:58
  • 1
    In the MQSC at the top you've defined a channel called `SYSTEM.ADMIN.SVRCONN` but your error logs show that a channel called `SYSTEM.DEF.SVRCONN` is closing. Is that correct? – Rob Parker Feb 22 '17 at 13:04
  • That's correct. I have no idea why SYSTEM.DEF.SVRCONN shows up in the log. Thanks a lot for looking into this for me. – Muthukumar Feb 22 '17 at 13:25
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/136358/discussion-between-muthukumar-and-rob-parker). – Muthukumar Feb 22 '17 at 13:26
  • How do you specify the channel details for the app to connect? Many of the sample apps default to `SYSTEM.DEF.SVRCONN` if a channel name is not passed. If that is the case and the `SYSTEM.DEF.SVRCONN` has a blank `MCAUSER`, then `root` would work since the `MCAUSER` would get set to `root` which is in the `mqm` group. Assuming that `muthu` is not in the `mqm` group it would not work. Try adding `MCAUSER'sampuser')` and test again, if that works then you just need to figure out why it is not using the channel you want it to use. – JoshMc Feb 22 '17 at 14:43
  • That is nice of you to give @RobParker a bounty, he deserves it! – JoshMc Apr 17 '20 at 09:43

1 Answers1

4

Looking at your MQSC code i see you have defined a Channel called SYSTEM.ADMIN.SVRCONN however i see in the logs that a channel called SYSTEM.DEF.SVRCONN is closing (following the connection failing).

Given that the sample program you posted does not set the MQCNO structure which is the way to programmatically pass a channel name and you haven't mentioned CCDT (which is the other way) i suspect your MQSERVER environment variable is incorrect.

Rob Parker
  • 765
  • 5
  • 19