簡體   English   中英

從java發送到MQ始終使用缺省安裝的mqm userid用於IBM MQ V6.0

[英]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')值。 這將覆蓋客戶端應用程序提供的任何值。

這里有幾點需要注意。

  1. 雖然您可以發送ID和密碼,但WMQ會以面值接受這些內容。 存在這些字段以使憑證可用於可以驗證它們的通道出口。 如果沒有這樣的退出,頻道就會以應用聲稱的任何ID運行,並忽略密碼。
  2. 由於上述原因,我總是告訴人們不要相信所提供的憑證,除非他們有這樣的退出。 管理員必須將適當的值編碼到MCAUSER中。
  3. 管理標識(UNIX flavor上的“mqm”)不是適當的值。 它賦予在該頻道上連接的任何人的管理權限。

有關此主題的更多內容以及IMPACT的WMQ安全演示和WMQ安全實驗室指南的指示,請參閱此SO問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM