0
我在做的時候無法生成密鑰對DH的HTTP調用是這樣的:了java.lang.RuntimeException:試圖使調用Web服務
HttpPost httppost = new HttpPost(url);
HttpClient httpclient = HttpClients.createDefault();
//ent is MultipartEntityBuilder ent
httppost.setEntity(ent.build());
try {
HttpResponse response = httpclient.execute(httppost);****
我收到錯誤的代碼與行****
javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.SSLSocketImpl.handleException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:279)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:257)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:132)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:349)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:365)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:221)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:199)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:87)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:109)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:84)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:109)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
我不太清楚是什麼原因造成的。有人能告訴我這是什麼原因嗎?我正在撥打網絡服務的其餘呼叫
如何處理此異常?我能夠正常撥打電話 – 2014-11-06 03:22:08
請確保url是http,而不是https。如果您正在自動重定向,那麼您需要編寫代碼來處理SSL握手。 Google'SSL握手java' – CharlieS 2014-11-07 00:01:47