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