java javax.net.ssl.SSLKeyException:致命警报:BAD_CERTIFICATE - 收到损坏或无法使用的证书

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28279811/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 13:19:45  来源:igfitidea点击:

javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received

javaweb-servicesjakarta-eewsdl2java

提问by Subhankar Das

I am getting this below error when trying to access an WSDL endpoint.

尝试访问 WSDL 端点时出现以下错误。

First I have created the client jar using cliengen ant task and then created a simple java class to test the wsdl end point and I am getting below error-

首先,我使用 cliengen ant 任务创建了客户端 jar,然后创建了一个简单的 java 类来测试 wsdl 端点,并且出现以下错误-

javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireException(Unknown Source)
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknown Source)
    at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown Source)
    at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown Source)
    at com.certicom.tls.record.MessageInterpreter.interpretContent(Unknown Source)
    at com.certicom.tls.record.MessageInterpreter.decryptMessage(Unknown Source)
    at com.certicom.tls.record.ReadHandler.processRecord(Unknown Source)
    at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
    at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown Source)
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown Source)
    at com.certicom.tls.record.WriteHandler.write(Unknown Source)
    at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
    at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
    at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
    at weblogic.webservice.binding.soap.HttpClientBinding.writeToStream(HttpClientBinding.java:430)
    at weblogic.webservice.binding.soap.HttpClientBinding.send(HttpClientBinding.java:219)
    at weblogic.webservice.core.handler.ClientHandler.handleRequest(ClientHandler.java:37)
    at weblogic.webservice.core.HandlerChainImpl.handleRequest(HandlerChainImpl.java:143)
    at weblogic.webservice.core.ClientDispatcher.send(ClientDispatcher.java:231)
    at weblogic.webservice.core.ClientDispatcher.dispatch(ClientDispatcher.java:143)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:471)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:457)
    at weblogic.webservice.core.rpc.StubImpl._invoke(StubImpl.java:303)

Can anyone help?

任何人都可以帮忙吗?

回答by Yusuf Kapasi

I was able to get resolve the exception by updating \Oracle\Middleware\user_projects\domains\my_domain\bin\setDomainEnv.cmd with below commands

我能够通过使用以下命令更新 \Oracle\Middleware\user_projects\domains\my_domain\bin\setDomainEnv.cmd 来解决异常

set JAVA_OPTIONS=%JAVA_OPTIONS% -DUseSunHttpHandler=true -Dssl.SocketFactory.provider=sun.security.ssl.SSLSocketFactoryImpl -Dssl.ServerSocketFactory.provider=sun.security.ssl.SSLSocketFactoryImpl

回答by shailesh shinde

Fixed this issue by adding following lines in JVM arguments.

通过在 JVM 参数中添加以下行来修复此问题。

-Dweblogic.security.SSL.nojce=true 
-Dweblogic.ssl.JSSEEnabled=true 
-Dweblogic.security.SSL.enableJSSE=true

Don't forget to recycle JVM. :)

不要忘记回收JVM。:)

回答by Ashutosh

Add this in startup params

在启动参数中添加这个

-DUseSunHttpHandler=true 
-Dssl.SocketFactory.provider=sun.security.ssl.SSLSocketFactoryImpl 
-Dssl.ServerSocketFactory.provider=sun.security.ssl.SSLSocketFactoryImpl