Closed 2020testuser closed 3 years ago
Not finding cmqc.h is a compile problem, not runtime.
@ibmmqmet - Thanks! I meant when I use go run
command, I get the above error. Using Dockerfile, I'm able to successfully do the build. But, when I run docker run command, I get the below error.
MQCONNX: MQCC = MQCC_FAILED [2] MQRC = MQRC_NOT_AUTHORIZED [2035]
Could you please let me know whether I need to change any permissions for /mq directories for the user that I'm using in the amqsput.go file?
Any suggestions to resolve the issue would be very useful. Thanks in advance!!
That's nothing to do with file permissions. The userid associated with the connection request is either not being authenticated (wrong userid/password) or is not authorised for some reason. The error logs in the qmgr will have more details. See amqsconn.go for how you can send userid/pw.
@ibmmqmet - Thanks for pointing to the amqsconn.go file. I tried disabling the authentication as below in the code and on the server side, the admin disabled (temporarily) disabled the validation as well. However, I'm still getting the same error.
Could you please let me know whether to disable the authentication, anything else need to be done? Any help would be very useful for me to move forward. In the Dockerfile, do I need to set the USER (as 1001 or non-root user)? I also included MQSNOAUT = yes in the Dockerfile. Still, no luck.
Thanks in advance! Modified Code: `
csp := ibmmq.NewMQCSP()
csp.AuthenticationType = ibmmq.MQCSP_AUTH_NONE //ibmmq.MQCSP_AUTH_USER_ID_AND_PWD
// Make the CNO refer to the CSP structure so it gets used during the connection
cno.SecurityParms = csp
}
// And now we can try to connect. Wait a short time before disconnecting.
qMgr, err = ibmmq.Connx(qMgrName, cno)`
Modified Dockerfile: Added the below lines in the docker file as was getting Permission denied error on /IBM and /mqm directories. 50000 is the port MQClient.
RUN chmod -R 777 $GOPATH_ARG/bin/amqsconn RUN chmod -R 777 $GOPATH_ARG/src/amqsconn.go RUN mkdir -p /IBM \ && chmod -R 777 /IBM RUN mkdir -p /.mqm \ && chmod -R 777 /.mqm ENV MQSNOAUT=yes EXPOSE 50000 8080
As I said before, the qmgr error logs will tell you what is wrong with your security config. Otherwise it's just guessing.
Thanks! I don't see container when I run the below command as the docker run failed with the message. If I have the container, I can check the logs. Could you please let me know whether there is any other way to check the logs? Sorry. I'm new to MQC and trying to get this working. Appreciate your help.
docker run mqcdocker:v1 Connection to MQMGR failed. MQCONNX: MQCC = MQCC_FAILED [2] MQRC = MQRC_NOT_AUTHORIZED [2035]
docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Also, this is what the admin sees on the server side.
`
Process(91789.2201) User(mqm) Program(test)
Host(myhostname) Installation(Installation1)
VRMF(9.1.0.3) QMgr(
AMQ9557E: Queue Manager User ID initialization failed for 'unknown'.
EXPLANATION: The call to initialize the User ID 'unknown' failed with CompCode 2 and Reason
`
@ibmmqmet - Do you have any info. to troubleshoot the issue ? If so, could you please send the details? Thanks!
Likely reasons are 1) You may have not set a valid userid/password combination in the CSP structure - based on how the qmgr is configured to authenticate ids (eg userids knowin in the container) 2) And/or perhaps the ADOPTCTX attribute on the queue manager's active AUTHINFO object is set to NO.
@ibmmqmet - Thanks! Yes, the userid didn't have the right permissions on the Dockerfile. Finally, worked after setting the right permissions.
Can anyone please help me? When I run the put program as below in MAC, I get the below error? Thanks in advance! go run amqsput.go QName1 QMgr1 `../../../../go/pkg/mod/github.com/ibm-messaging/mq-golang/v5@v5.2.0/ibmmq/mqi.go:54:10: fatal error: 'cmqc.h' file not found
include`