Java クライアントおよび WebSphere MQ の SSL サポートの使用

ハッセイ123

Java クライアントを使用して IBM MQ に接続しようとしています。以下のチュートリアルに従って、必要なキーデータベース、キーストア、およびトラストストア ファイルをセットアップしました。

https://qadeer786.wordpress.com/2013/10/08/using-ssl-support-for-java-clients-websphere-mq/

Java クライアントを実行すると、次のエラーが表示されます。

com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2397'.
    at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:249)
    at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:450)
    at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:487)
    at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:97)
    at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:194)
    at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:868)
    at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:816)
    at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:758)
    at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:200)
    at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:682)
    at esb.wso2.org.client.MQConnectionBuilder.<init>(MQConnectionBuilder.java:52)
    at esb.wso2.org.client.MQConnectionBuilder.getInstance(MQConnectionBuilder.java:60)
    at esb.wso2.org.client.MQProducer.<init>(MQProducer.java:20)
    at esb.wso2.org.client.MQClient.main(MQClient.java:7)
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2397;AMQ9204: Connection to host '127.0.0.1(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2397;AMQ9771: SSL handshake failed. [1=javax.net.ssl.SSLHandshakeException[Remote host closed connection during handshake],3=localhost/127.0.0.1:1414 (localhost),4=SSLSocket.startHandshake,5=default]],3=127.0.0.1(1414),5=RemoteTCPConnection.protocolConnect]
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2282)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1294)
    at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:376)
    at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:560)
    at com.ibm.mq.MQSESSION.MQCONNX_j(MQSESSION.java:916)
    at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:235)
    ... 13 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2397;AMQ9771: SSL handshake failed. [1=javax.net.ssl.SSLHandshakeException[Remote host closed connection during handshake],3=localhost/127.0.0.1:1414 (localhost),4=SSLSocket.startHandshake,5=default]
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1329)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:863)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:409)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:305)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:146)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1730)
    ... 18 more
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:992)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$6.run(RemoteTCPConnection.java:1298)
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$6.run(RemoteTCPConnection.java:1290)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1290)
    ... 23 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
    at sun.security.ssl.InputRecord.read(InputRecord.java:505)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
    ... 30 more
com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2397'.
    at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:249)
    at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:450)
    at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:487)
    at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:97)
    at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:194)
    at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:868)
    at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:816)
    at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:758)
    at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:200)
    at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:682)
    at esb.wso2.org.client.MQConnectionBuilder.getQueueManager(MQConnectionBuilder.java:68)
    at esb.wso2.org.client.MQProducer.<init>(MQProducer.java:22)
    at esb.wso2.org.client.MQClient.main(MQClient.java:7)
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2397;AMQ9204: Connection to host '127.0.0.1(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2397;AMQ9771: SSL handshake failed. [1=javax.net.ssl.SSLHandshakeException[Remote host closed connection during handshake],3=localhost/127.0.0.1:1414 (localhost),4=SSLSocket.startHandshake,5=default]],3=127.0.0.1(1414),5=RemoteTCPConnection.protocolConnect]
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2282)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1294)
    at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:376)
    at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:560)
    at com.ibm.mq.MQSESSION.MQCONNX_j(MQSESSION.java:916)
    at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:235)
    ... 12 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2397;AMQ9771: SSL handshake failed. [1=javax.net.ssl.SSLHandshakeException[Remote host closed connection during handshake],3=localhost/127.0.0.1:1414 (localhost),4=SSLSocket.startHandshake,5=default]
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1329)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:863)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:409)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:305)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:146)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1730)
    ... 17 more
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:992)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$6.run(RemoteTCPConnection.java:1298)
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$6.run(RemoteTCPConnection.java:1290)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1290)
    ... 22 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
    at sun.security.ssl.InputRecord.read(InputRecord.java:505)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
    ... 29 more

以下に、キュー マネージャー (qmanager) のログ ファイルを示します。

 2017-06-24 11:31:11 - Process(25266.5) User(root) Program(amqrmppa)
                    Host(hasitha-HP-Pavilion-g6-Notebook-PC) Installation(Installation1)
                    VRMF(8.0.0.4) QMgr(qmanager)

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 : 6283 -------------------------------------------------------
2017-06-24 11:31:11 - Process(25266.5) User(root) Program(amqrmppa)
                    Host(hasitha-HP-Pavilion-g6-Notebook-PC) Installation(Installation1)
                    VRMF(8.0.0.4) QMgr(qmanager)

AMQ9999: Channel '????' to host 'localhost (127.0.0.1)' ended abnormally.

EXPLANATION:
The channel program running under process ID 25266 for channel '????' ended
abnormally. The host name is 'localhost (127.0.0.1)'; in some cases the host
name cannot be determined and so is shown as '????'.
ACTION:
Look at previous error messages for the channel program in the error logs to
determine the cause of the failure. Note that this message can be excluded
completely or suppressed by tuning the "ExcludeMessage" or "SuppressMessage"
attributes under the "QMErrorLog" stanza in qm.ini. Further information can be
found in the System Administration Guide.
----- amqrmrsa.c : 930 --------------------------------------------------------
2017-06-24 11:33:54 - Process(25266.6) User(root) Program(amqrmppa)
                    Host(hasitha-HP-Pavilion-g6-Notebook-PC) Installation(Installation1)
                    VRMF(8.0.0.4) QMgr(qmanager)

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 : 6283 -------------------------------------------------------
2017-06-24 11:33:54 - Process(25266.6) User(root) Program(amqrmppa)
                    Host(hasitha-HP-Pavilion-g6-Notebook-PC) Installation(Installation1)
                    VRMF(8.0.0.4) QMgr(qmanager)

AMQ9999: Channel '????' to host 'localhost (127.0.0.1)' ended abnormally.

EXPLANATION:
The channel program running under process ID 25266 for channel '????' ended
abnormally. The host name is 'localhost (127.0.0.1)'; in some cases the host
name cannot be determined and so is shown as '????'.
ACTION:
Look at previous error messages for the channel program in the error logs to
determine the cause of the failure. Note that this message can be excluded
completely or suppressed by tuning the "ExcludeMessage" or "SuppressMessage"
attributes under the "QMErrorLog" stanza in qm.ini. Further information can be
found in the System Administration Guide.
----- amqrmrsa.c : 930 --------------------------------------------------------
2017-06-24 11:33:55 - Process(25266.7) User(root) Program(amqrmppa)
                    Host(hasitha-HP-Pavilion-g6-Notebook-PC) Installation(Installation1)
                    VRMF(8.0.0.4) QMgr(qmanager)

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 : 6283 -------------------------------------------------------
2017-06-24 11:33:55 - Process(25266.7) User(root) Program(amqrmppa)
                    Host(hasitha-HP-Pavilion-g6-Notebook-PC) Installation(Installation1)
                    VRMF(8.0.0.4) QMgr(qmanager)

AMQ9999: Channel '????' to host 'localhost (127.0.0.1)' ended abnormally.

EXPLANATION:
The channel program running under process ID 25266 for channel '????' ended
abnormally. The host name is 'localhost (127.0.0.1)'; in some cases the host
name cannot be determined and so is shown as '????'.
ACTION:
Look at previous error messages for the channel program in the error logs to
determine the cause of the failure. Note that this message can be excluded
completely or suppressed by tuning the "ExcludeMessage" or "SuppressMessage"
attributes under the "QMErrorLog" stanza in qm.ini. Further information can be
found in the System Administration Guide.
----- amqrmrsa.c : 930 --------------------------------------------------------

これを解決する方法についてのアイデア.私にはユーザーグループ mqm があり、root と $USER(hasitha) の両方がそのグループのユーザーです。

モラグ・ヒューソン

あなたが従ったチュートリアルは Windows のようですが、最後のコメントから、あなたは Unix システムを使用していると思います。

キュー マネージャのキー データベース ファイルの所有権を確認する必要があります。

キュー マネージャーのエラー ログは、次のように示されている場合にこれを示唆しています。

(c) the files are present in the correct place but the userid under which MQ is
      running does not have permission to read them, 

チュートリアルのキュー マネージャー キー データベース ファイル C:\temp\ssldemo1\ を含むディレクトリに移動し、次のコマンドを使用して、そこにある 4 つのファイルの所有権を mqm に変更します。

chown mqm TEST.QM1.*

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Websphere MQクライアントのクライアント証明書でSSLを有効にする方法は?

分類Dev

JMSのSpring構成(Websphere MQ-SSL、Tomcat、JNDI、IBM以外のJRE)

分類Dev

SSLを介したJMSを使用したWebSphere MQ 7.0への接続

分類Dev

LinuxでのブーストおよびSSLクライアントサーバーの構築の問題

分類Dev

IBM Websphere MQ Publisherの確認と消費者の承認、.NETクライアント

分類Dev

Websphere MQ:com.ibm.mq.jms.MQSessionでのメソッドcreateQueue(java.lang.String queueName)の適切な使用法

分類Dev

.Net 3.5上のWebサービスクライアントアプリケーション用のSSLおよび古いTLS(1.0および1.1)

分類Dev

MQキーストアでのSSL証明書の交換

分類Dev

JavaクライアントでのMQヘッダーの設定

分類Dev

Javaサーブレット、JSP、および2つのクライアント間のデータ転送

分類Dev

リモートクライアントおよびSSLからのfile_get_contents

分類Dev

WebSphere MQ:Java APIを使用してMQSCコマンドを発行する方法

分類Dev

JMeter 3.2 IBM MQ 8のポイントツーポイント構成=> Java例外

分類Dev

Websphere.MQ通信での誤ったエンコーディング

分類Dev

Websphere MessageBrokerおよびWebsphereTransformationExtenderのインストール

分類Dev

Javaクライアント(JMS)をIBM MQに接続する際の問題

分類Dev

JavaゲームサーバーからクライアントへのTCPおよびUDP接続

分類Dev

Mosquitto TLS / SSL SSL3_READ_BYTES:sslハンドシェイクの失敗、エラー:成功およびsslv3アラート

分類Dev

JavaでのSSLクライアント証明書の選択

分類Dev

JMSを使用したWebSphere MQ

分類Dev

Javaを使用したWebおよびAndroidクライアントを使用したアプリの開発

分類Dev

Websphere ApplicationServerのインポート設定

分類Dev

SSL対応のJava JMXクライアント

分類Dev

WebSphere MQのメッセージグループ

分類Dev

IBM MQ:SSL接続の確立

分類Dev

JavaによるIBM MQの監視

分類Dev

Websphere8でのJAX-RSJersey2.10のサポート

分類Dev

TCPサーバーおよびクライアントJava

分類Dev

0MQ.NETによるUDPのサポート

Related 関連記事

  1. 1

    Websphere MQクライアントのクライアント証明書でSSLを有効にする方法は?

  2. 2

    JMSのSpring構成(Websphere MQ-SSL、Tomcat、JNDI、IBM以外のJRE)

  3. 3

    SSLを介したJMSを使用したWebSphere MQ 7.0への接続

  4. 4

    LinuxでのブーストおよびSSLクライアントサーバーの構築の問題

  5. 5

    IBM Websphere MQ Publisherの確認と消費者の承認、.NETクライアント

  6. 6

    Websphere MQ:com.ibm.mq.jms.MQSessionでのメソッドcreateQueue(java.lang.String queueName)の適切な使用法

  7. 7

    .Net 3.5上のWebサービスクライアントアプリケーション用のSSLおよび古いTLS(1.0および1.1)

  8. 8

    MQキーストアでのSSL証明書の交換

  9. 9

    JavaクライアントでのMQヘッダーの設定

  10. 10

    Javaサーブレット、JSP、および2つのクライアント間のデータ転送

  11. 11

    リモートクライアントおよびSSLからのfile_get_contents

  12. 12

    WebSphere MQ:Java APIを使用してMQSCコマンドを発行する方法

  13. 13

    JMeter 3.2 IBM MQ 8のポイントツーポイント構成=> Java例外

  14. 14

    Websphere.MQ通信での誤ったエンコーディング

  15. 15

    Websphere MessageBrokerおよびWebsphereTransformationExtenderのインストール

  16. 16

    Javaクライアント(JMS)をIBM MQに接続する際の問題

  17. 17

    JavaゲームサーバーからクライアントへのTCPおよびUDP接続

  18. 18

    Mosquitto TLS / SSL SSL3_READ_BYTES:sslハンドシェイクの失敗、エラー:成功およびsslv3アラート

  19. 19

    JavaでのSSLクライアント証明書の選択

  20. 20

    JMSを使用したWebSphere MQ

  21. 21

    Javaを使用したWebおよびAndroidクライアントを使用したアプリの開発

  22. 22

    Websphere ApplicationServerのインポート設定

  23. 23

    SSL対応のJava JMXクライアント

  24. 24

    WebSphere MQのメッセージグループ

  25. 25

    IBM MQ:SSL接続の確立

  26. 26

    JavaによるIBM MQの監視

  27. 27

    Websphere8でのJAX-RSJersey2.10のサポート

  28. 28

    TCPサーバーおよびクライアントJava

  29. 29

    0MQ.NETによるUDPのサポート

ホットタグ

アーカイブ