如何修复'NoClassDefFoundError:无法初始化类sun.security.ssl.SSLContextImpl $ DefaultManagersHolder'

时间:2019-08-26 08:58:26

标签: java ssl zendesk-api

我致力于使用SSL连接到外部API(Zendesk API)的应用程序。

它曾经可以正常工作,但是现在只要应用程序尝试连接到Zendesk API,我们都会收到以下错误:java.net.ConnectException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)NoClassDefFoundError: Could not initialize class sun.security.ssl.SSLContextImpl$DefaultManagersHolder引起。

我们在Debian 8.11上使用Java 1.7.0_231。

我在互联网上找不到任何解决方案。

我已经检查了凭据:它们是正确的。

从我在互联网上发现的错误来看,该错误可能是由缺少jar“ jsse.jar”引起的,但我已经检查并发现了它。

它在其他环境(带有Java 1.7.0_211的Debian 9.9)上可以正常工作。

这是堆栈跟踪:

    at com.ning.http.client.providers.netty.future.NettyResponseFuture.abort(NettyResponseFuture.java:231)
    at com.ning.http.client.providers.netty.request.NettyConnectListener.onFutureFailure(NettyConnectListener.java:137)
    at com.ning.http.client.providers.netty.request.NettyConnectListener.operationComplete(NettyConnectListener.java:145)
    at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:409)
    at org.jboss.netty.channel.DefaultChannelFuture.addListener(DefaultChannelFuture.java:145)
    at com.ning.http.client.providers.netty.request.NettyRequestSender.sendRequestWithNewChannel(NettyRequestSender.java:284)
    at com.ning.http.client.providers.netty.request.NettyRequestSender.sendRequestWithCertainForceConnect(NettyRequestSender.java:142)
    at com.ning.http.client.providers.netty.request.NettyRequestSender.sendRequest(NettyRequestSender.java:117)
    at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:87)
    at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:506)
    at org.zendesk.client.v2.Zendesk.submit(Zendesk.java:1771)
    at org.zendesk.client.v2.Zendesk.access$1300(Zendesk.java:91)
    ... 90 more
Caused by: java.net.ConnectException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
    at com.ning.http.client.providers.netty.request.NettyConnectListener.onFutureFailure(NettyConnectListener.java:133)
    ... 100 more
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
    at java.security.Provider$Service.newInstance(Provider.java:1256)
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
    at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156)
    at javax.net.ssl.SSLContext.getDefault(SSLContext.java:97)
    at com.ning.http.util.SslUtils.getSSLContext(SslUtils.java:70)
    at com.ning.http.client.SSLEngineFactory$DefaultSSLEngineFactory.newSSLEngine(SSLEngineFactory.java:49)
    at com.ning.http.client.providers.netty.channel.ChannelManager.createSslHandler(ChannelManager.java:401)
    at com.ning.http.client.providers.netty.channel.SslInitializer.connectRequested(SslInitializer.java:44)
    at org.jboss.netty.channel.SimpleChannelDownstreamHandler.handleDownstream(SimpleChannelDownstreamHandler.java:88)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:591)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendDownstream(DefaultChannelPipeline.java:784)
    at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:54)
    at org.jboss.netty.handler.codec.http.HttpClientCodec.handleDownstream(HttpClientCodec.java:97)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:591)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendDownstream(DefaultChannelPipeline.java:784)
    at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleDownstream(ChunkedWriteHandler.java:109)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:591)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:582)
    at org.jboss.netty.channel.Channels.connect(Channels.java:634)
    at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:216)
    at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:229)
    at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:182)
    at com.ning.http.client.providers.netty.request.NettyRequestSender.connect(NettyRequestSender.java:377)
    at com.ning.http.client.providers.netty.request.NettyRequestSender.sendRequestWithNewChannel(NettyRequestSender.java:283)
    ... 96 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class sun.security.ssl.SSLContextImpl$DefaultManagersHolder
    at sun.security.ssl.SSLContextImpl$DefaultSSLContext.<init>(SSLContextImpl.java:1006)
    at sun.reflect.GeneratedConstructorAccessor559.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at java.security.Provider$Service.newInstance(Provider.java:1237)
    ... 120 more

任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)

此错误是在openjdk的debian软件包的最新更新(版本7u231-2.6.19-1〜deb8u1)中引入的。 它已在版本7u231-2.6.19-1〜deb8u2中修复。

请参见https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=935082