简体   繁体   中英

Can't connect to IBMMQ MQRC_NOT_UNAUTHORIZED

I have installed IBMMQ 9.0 in windows running in virtualbox in my local and I have sample java code sending message to MQ.

here is the java code

 MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
 cf.setHostName(MY_IP);
 cf.setPort(1417);
 cf.setTransportType(WMQConstants.WMQ_CM_CLIENT);
 cf.setQueueManager("QM1_TEST");
 cf.setChannel("QM1_TEST.CH");
 MQQueueConnection connection = (MQQueueConnection)
 cf.createQueueConnection();
 MQQueueSession session = (MQQueueSession)
 connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
 MQQueue queue = (MQQueue) session.createQueue("queue:///QUEUE_TEST");
 MQQueueSender sender = (MQQueueSender) session.createSender(queue);
 String message = "Test Message";
 TextMessage textMessage = (TextMessage)   
 session.createTextMessage(message);
 connection.start();
 sender.send(textMessage);

The program receives this error.

com.ibm.msg.client.jms.DetailedJMSSecurityException: JMSWMQ2013: The
security authentication was not valid that was supplied for QueueManager  
'QM1_TEST' with connection mode 'Client' and host name '192.168.0.24(1417)'.
Please check if the supplied username and password are correct on the  
QueueManager to which you are connecting. at
com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:531)
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:215)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:424)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:8475)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:7815)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createConnection(JmsConnectionFactoryImpl.java:303)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:236)
at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6016)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:111)
at com.cwt.bpg.cbr.demo.ibm.mq.client.SendMessage.main(SendMessage.java:24)
Caused by: com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED').
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)
... 8 more

Here is the log under my queue manager with significant details.

5/21/2018 16:42:46 - Process(4984.8) User(MUSR_MQADMIN) Program
(amqrmppa.exe) Host(MSEDGEWIN10) Installation(Installation1) VRMF(9.0.0.0) 
QMgr(QM1_DEV) AMQ9776: Channel was blocked by userid 
EXPLANATION: 
The inbound channel 'QM1_DEV.CH' was blocked from address '10.xx.xx.xx' 
because the active values of the channel were mapped to a userid which    
should be blocked. The active values of the channel were 'MCAUSER(IEUser) 
CLNTUSER(IEUser) ADDRESS(LWPHL1U012FXP)'

You are not providing a user and password, your are connecting with the default user identity.

QueueConnection createQueueConnection()
Creates a queue connection with default user identity.

You can either provide credentials:

QueueConnection createQueueConnection(String userid,String password)

By default the userid and password for any user in the mqm group on the MQ broker will have access to the queue managers.

The IBM MQ docs also have instructions for disabling security altogether.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM