0

为了在 DB2 中启用 SSL,我已经完成了以下链接中解释的所有过程。

http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.sec.doc%2Fdoc%2Ft0025241.html

之后,我使用以下命令将证书添加到 cacerts,

keytool -import -file "C:\\Program Files\\IBM\\gsk8\\bin\\keystore.arm" -alias keystore -keystore "C:\\Program Files\\Java\\jre6\\lib\\security\\cacerts"

我在代码中写了以下几行,

DB2ConnectionPoolDataSource dataSource = new DB2ConnectionPoolDataSource();
dataSource.setSslConnection(true);    
dataSource.setSslTrustStoreLocation("trust store file path");
dataSource.setSslTrustStorePassword("changeit");
PooledConnection ps = dataSource.getPooledConnection();
connection = ps.getConnection();

我收到握手异常。下面是堆栈跟踪,

    com.ibm.db2.jcc.am.DisconnectNonTransientConnectionException: [jcc][t4][2030][11211][4.16.53] A communication error occurred during operations on the connection's underlying socket, socket input stream, 
or socket output stream.  Error location: Reply.fill() - socketInputStream.read (-1).  Message: Remote host closed connection during handshake. ERRORCODE=-4499, SQLSTATE=08001
    at com.ibm.db2.jcc.am.fd.a(fd.java:320)
    at com.ibm.db2.jcc.t4.a.a(a.java:526)
    at com.ibm.db2.jcc.t4.a.a(a.java:510)
    at com.ibm.db2.jcc.t4.a.a(a.java:505)
    at com.ibm.db2.jcc.t4.a.b(a.java:1557)
    at com.ibm.db2.jcc.t4.a.a(a.java:1592)
    at com.ibm.db2.jcc.t4.a.f(a.java:452)
    at com.ibm.db2.jcc.t4.a.flush_(a.java:387)
    at com.ibm.db2.jcc.am.Agent.flowOutsideUOW(Agent.java:261)
    at com.ibm.db2.jcc.t4.b.b(b.java:1224)
    at com.ibm.db2.jcc.t4.b.b(b.java:793)
    at com.ibm.db2.jcc.t4.b.a(b.java:765)
    at com.ibm.db2.jcc.t4.b.a(b.java:423)
    at com.ibm.db2.jcc.t4.b.a(b.java:398)
    at com.ibm.db2.jcc.t4.b.<init>(b.java:336)
    at com.ibm.db2.jcc.DB2PooledConnection.<init>(DB2PooledConnection.java:83)
    at com.ibm.db2.jcc.DB2ConnectionPoolDataSource.getPooledConnectionX(DB2ConnectionPoolDataSource.java:348)
    at com.ibm.db2.jcc.DB2ConnectionPoolDataSource.getPooledConnection(DB2ConnectionPoolDataSource.java:131)
    at db2.DB2SSLConfiguration.buildConnection(DB2SSLConfiguration.java:210)
    at db2.DB2SSLConfiguration.main(DB2SSLConfiguration.java:152)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
    at com.ibm.db2.jcc.t4.db.b(db.java:1715)
    at com.ibm.db2.jcc.t4.db.a(db.java:1663)
    at com.ibm.db2.jcc.t4.a.f(a.java:437)
    ... 13 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
    at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
    ... 20 more

对此的任何指示将不胜感激。

4

0 回答 0