簡體   English   中英

嘗試通過Java客戶端訪問MQ 7.5服務器但出現錯誤,已創建SYSTEM.SSL.SVRCONN

[英]Trying to access MQ 7.5 server through java client but getting error,has created SYSTEM.SSL.SVRCONN

沒有SSL,我就可以連接,但是有了SSL,它會在MQ日志中拋出以下錯誤

AMQ9660: SSL key repository: password stash file absent or unusable.

EXPLANATION:
The SSL key repository cannot be used because MQ cannot obtain a password to
access it. Reasons giving rise to this error include: 
(a) the key database file and password stash file are not present in the
  location configured for the key repository, 
(b) the key database file exists in the correct place but that no password
  stash file has been created for it, 
(c) the files are present in the correct place but the userid under which MQ is
  running does not have permission to read them, 
(d) one or both of the files are corrupt. 

The channel is '????'; in some cases its name cannot be determined and so is
shown as '????'. The channel did not start.
ACTION:
Ensure that the key repository variable is set to where the key database file
is. Ensure that a password stash file has been associated with the key database
file in the same directory, and that the userid under which MQ is running has
read access to both files. If both are already present and readable in the
correct place, delete and recreate them. Restart the channel. 
----- amqccisa.c : 5577 -------------------------------------------------------
6/30/2015 12:15:33 - Process(14120.5) User(locahost) Program(amqrmppa.exe)
                      Host(localhost) Installation(Installation1)
                      VRMF(7.5.0.2) QMgr(QM1)

AMQ9492: The TCP/IP responder program encountered an error.

這是產生錯誤的代碼:

import javax.jms.JMSException;
import javax.jms.Session;

import com.ibm.mq.*;
import com.ibm.jms.JMSMessage;
import com.ibm.jms.JMSTextMessage;
import com.ibm.mq.jms.JMSC;
import com.ibm.mq.jms.MQQueue;
import com.ibm.mq.jms.MQQueueConnection;
import com.ibm.mq.jms.MQQueueConnectionFactory;
import com.ibm.mq.jms.MQQueueReceiver;
import com.ibm.mq.jms.MQQueueSender;
import com.ibm.mq.jms.MQQueueSession;

import java.io.*;

import javax.net.ssl.*;

import java.net.ServerSocket;
import java.net.Socket;
import java.security.KeyStore;
/**
 * simple testcase for Point-to-point messaging .
 */
public class MQTEST {
  /**
   * Main method
   *
   * @param args
   */
  public static void main(String[] args) {
    try {
        SSLContext context = SSLContext.getDefault();
        System.setProperty("javax.net.ssl.trustStore","D:\\IBM\\CERT\\truststore.jks");
         System.setProperty("javax.net.ssl.keyStore","D:\\IBM\\Websphere\\Qmgrs\\QM1\\ssl\\key.kdb");
       System.setProperty("javax.net.ssl.keyStorePassword","password");





      MQQueueConnectionFactory cf = new MQQueueConnectionFactory();

      // Config
      cf.setHostName("localhost");
      cf.setPort(1414);
      cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
      cf.setQueueManager("QM1");
     cf.setChannel("SYSTEM.SSL.SVRCONN");
    // cf.setChannel("SYSTEM.DEF.SVRCONN");

     cf.setSSLCipherSuite("TLS_RSA_WITH_AES_128_CBC_SHA");



      MQQueueConnection connection = (MQQueueConnection) cf.createQueueConnection();


      MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
      MQQueue queue = (MQQueue) session.createQueue("queue:///LQ1");
      MQQueueSender sender =  (MQQueueSender) session.createSender(queue);

錯誤日志格式和問題的措辭表明,是隊列管理器無法訪問其KDB密鑰庫。

(注意:提供錯誤日志時,請告訴我們您是從QMgr還是從客戶端獲取的!“ MQ日志”可能會以任何一種方式出現。)

考慮到這一點,您應該執行設置過程來配置隊列管理器的證書。 這包括:

  1. 生成一個空的KDB文件,指定“隱藏密碼”選項
  2. 生成自簽名證書或證書簽名請求(CSR)

如果這是用於CA簽名的證書...

  1. 簽署企業社會責任
  2. 將證書頒發機構的簽名者證書導入QMgr的KDB和客戶端密鑰庫
  3. 將已簽名的CSR接收到密鑰庫中

如果這是用於自簽名證書...

  1. 提取自簽名證書的公共部分
  2. 將自簽名證書導入客戶端的密鑰庫

如果省略了任何這些步驟,請從上次中斷的地方繼續。

如果忘記存儲密碼或存儲文件已損壞,請使用iKeyman GUI或runmqakm命令的相應選項重新創建密碼。

請注意,如果完全不存在KDB,則QMgr仍會引發上述錯誤。 這是因為它所做的第一件事就是嘗試打開隱藏文件。 如果找不到,則會拋出password stash file absent or unusable錯誤。 即使沒有創建KDB,也是如此。

隊列管理器使用的密鑰存儲庫的存儲文件可能已損壞。 在這種情況下,我要做的是:

1)刪除隱藏文件。

2)在IBM Key Management Utility中打開密鑰庫。

3)使用“ Key Database File/Stash Password存儲Key Database File/Stash Password菜單再次創建一個新的存儲文件。

然后嘗試再次連接。

您的客戶端應用程序代碼使用javax.net.ssl.keyStore .kdb類型密鑰存儲庫。 據我所知,MQ Java客戶端將僅使用.jks類型的密鑰存儲。 .kdb類型的密鑰庫由隊列管理器和非Java客戶端(如C / C#)使用

HTH

暫無
暫無

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

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