ibm-messaging / mq-golang

Calling IBM MQ from Go applications
Apache License 2.0
167 stars 60 forks source link

CCDTurl in http and ftp format throwing MQRC_NOT_AUTHORIZED [2035] #192

Closed ssuryava-tibco closed 1 year ago

ssuryava-tibco commented 2 years ago

Hi Team,

I am using CCDTurl in below format

ftp://myuser:password@myhost.sample.com/var/mqm/qmgrs/QMGR/@ipcc/AMQCLCHL.TAB http://myuser:password@myhost.sample.com/var/mqm/qmgrs/QMGR/@ipcc/AMQCLCHL.TAB

But getting authority error as below

ERROR [mq.activity.put] - Execution failed for Activity[Put] in Flow[FTPccdt] - Put failed to create queue manager [MQ102] for reason [MQCONNX: MQCC = MQCC_FAILED [2] MQRC = MQRC_NOT_AUTHORIZED [2035]

Here the piece of code I am using

    mqcno := ibmmq.NewMQCNO()
mqcd := ibmmq.NewMQCD()
mqsco := ibmmq.NewMQSCO()
mqcno.CCDTUrl = ccdturl
mqcno.SSLConfig = mqsco
mqcd.ChannelName = chname
mqcd.ConnectionName = host + "(" + port + ")"
//mqcno.ClientConn = mqcd

@ibmmqmet , could you please suggest. Could you please suggest.

Thanks, Sneha

ibmmqmet commented 2 years ago

As you should easily find with a search for solutions to 2035 errors, there is usually lots of information in the qmgr and client error logs.

ssuryava-tibco commented 1 year ago

@ibmmqmet , I am specifying CCDTUrl as below mqcno.CCDTUrl = "file:///home/ssuryava/Downloads/AMQCLCHL.TAB"

The url is working on chrome, but still getting below issue

AMQ9795E: The client channel definition could not be retrieved from its URL, error code (25). MQCONNX: MQCC = MQCC_FAILED [2] MQRC = MQRC_Q_MGR_NAME_ERROR [2058]

Please suggest

ibmmqmet commented 1 year ago

The only way I can get that error is to have the file unreadable - either with a wrong name, or file permissions don't allow me to read it. Make sure you've got the name right, including case sensitivity.

You can always add debug like fmt.Printf("CNO is %+v\n",cno) before the Connx call to make sure you really have set what you think.

ssuryava-tibco commented 1 year ago

@ibmmqmet , CNO is showing as below File name is also correct, case vise. Is it due toClientConn:<nil>??

CNO is &{Version:1 Options:67373120 SecurityParms:0xc000962480 CCDTUrl:file:///home/ssuryava/Downloads/AMQCLCHL.TAB ClientConn:<nil> SSLConfig:0xc000574410 ApplName:IBM MQ}

ibmmqmet commented 1 year ago

Since that logged line doesn't report the BalanceParms structure, I'm guessing that you're running a version of the code that's at least a year old. (That structure has got nothing to do with the problem, but it was added to the options last year.)

Making sure you're at current levels of both this library and the underlying MQ client libraries would rule out any known problems that might have been fixed - I don't know of any, but it's always worth being up to date. And running the program under strace might show something with the openat call.

For example,

strace -f go run put.go 2>&1 | grep CLCHL