本文介绍了SSLSocketImpl.getEnabledCipherSuites中的NPE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在多个工作者中使用Apache HTTP客户端,看起来存在某种竞争条件(堆栈跟踪在最后)。我很困惑,谷歌搜索堆栈跟踪没有提供任何提示(尚未)。在Linux上使用Java 1.7.0-b147 64位。

I am using Apache HTTP client in multiple workers, and it looks like there is some kind of race condition (stacktrace is at the end). I am puzzled as googling the stacktrace does not provide any hint (yet). Using Java 1.7.0-b147 64bits on Linux.


  1. 我在这里做错了吗?

  2. Sun的实现 SSLSocket 是否有已知的有效替代方案?

  1. Am I doing something wrong here?
  2. Are there known, efficient alternatives to Sun's implementations of SSLSocket?

编辑:
也许没用,但调用代码如下:

Maybe not useful, but the calling code is like :

public String call() {
    HttpUriRequest request = new HttpGet(aUrl);
    HttpResponse response = httpClient.execute(request);
    StatusLine statusLine = response.getStatusLine();
    return EntityUtils.toString(response.getEntity());
}

其中httpClient与所有callable共享。

in which the httpClient is shared to all callables.

Stacktrace:

java.lang.NullPointerException
 at sun.security.ssl.SSLSocketImpl.getEnabledCipherSuites(SSLSocketImpl.java:2320)
 at javax.net.ssl.SSLSocket.getSSLParameters(SSLSocket.java:614)
 at sun.security.ssl.SSLSocketImpl.getSSLParameters(SSLSocketImpl.java:2406)
 at sun.security.ssl.SSLAlgorithmConstraints.<init>(SSLAlgorithmConstraints.java:65)
 at sun.security.ssl.Handshaker.init(Handshaker.java:236)
 at sun.security.ssl.Handshaker.<init>(Handshaker.java:191)
 at sun.security.ssl.ClientHandshaker.<init>(ClientHandshaker.java:104)
 at sun.security.ssl.SSLSocketImpl.initHandshaker(SSLSocketImpl.java:1217)
 at sun.security.ssl.SSLSocketImpl.doneConnect(SSLSocketImpl.java:634)
 at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:608)
 at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:414)
 at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
 at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
 at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
 at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
 at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
 at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
 at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784) 


推荐答案

这是一个JDK问题。运行JDK 1.7.0_u4时遇到此问题,升级到JDK 1.7.0_u25后解决了这个问题。

This is a JDK issue. We had this issue when running JDK 1.7.0_u4 and it was resolved after upgrading to JDK 1.7.0_u25.

这篇关于SSLSocketImpl.getEnabledCipherSuites中的NPE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 14:32