[英]Send to MQ from java always uses default installed mqm userid for IBM MQ version 6.0
我們的代碼在weblogic和MQ 6.0中運行。 無論我使用默認的createQueueConnection()
還是createQueueConnection("myuserid","mypassword")
它似乎總是使用userid mqm
。 見下面的代碼。
當我從版本6.0連接到較舊的mq安裝5時,它似乎拋出以下錯誤javax.jms.JMSSecurityException: MQJMS2013: invalid security authentication supplied for MQQueueManager
使用默認的createQueueConnection()
javax.jms.JMSSecurityException: MQJMS2013: invalid security authentication supplied for MQQueueManager
除非我在createQueueConnection("","")
發送空白用戶標識/密碼createQueueConnection("","")
如何才能發送myuserid?
Hashtable properties = new Hashtable(2);
properties.put(Context.PROVIDER_URL,context);
properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
InitialContext ctx = new InitialContext(properties);
QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup("QCF");
QueueConnection qc = qcf.createQueueConnection();
javax.jms.Queue q = (javax.jms.Queue) ctx.lookup("MYQUEUE");
QueueSession qs = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
TextMessage tm = qs.createTextMessage();
tm.setText(outString);
QueueSender sender = qs.createSender(q);
sender.send(tm);
sender.close();
qs.close();
qc.close();
如果要設置在的createQueueConnection的ID,放心,它被提交給隊列管理器。 您看到的問題是QMgr上的SVRCONN通道定義具有硬編碼的MCAUSER('mqm')值。 這將覆蓋客戶端應用程序提供的任何值。
這里有幾點需要注意。
有關此主題的更多內容以及IMPACT的WMQ安全演示和WMQ安全實驗室指南的指示,請參閱此SO問題 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.