JETTY:HTTPS请求异常unable to find valid certification path to requested target

今天使用Jetty请求HTTPS发生异常,异常如下:

12:14:19.030 [main] DEBUG o.eclipse.jetty.client.HttpExchange - Failed HttpExchange@70b42eaf req=TERMINATED/javax.net.ssl.SSLHandshakeException: General SSLEngine problem@196b73d1 res=TERMINATED/javax.net.ssl.SSLHandshakeException: General SSLEngine problem@196b73d1: req=false/rsp=false java.util.concurrent.ExecutionException: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
Exception in thread "main" java.util.concurrent.ExecutionException: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
    at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118)
    at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:110)
    at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:654)
    at com.smarthome.output.httpclient.WebClient.sendRequest(WebClient.java:138)
    at com.smarthome.output.httpclient.WebClientCodeOutput.sendRequest(WebClientCodeOutput.java:61)
    at com.smarthome.output.lora.LoRaFactory.main(LoRaFactory.java:22)
Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
    at sun.security.ssl.Handshaker.checkThrown(Unknown Source)
    at sun.security.ssl.SSLEngineImpl.checkTaskThrown(Unknown Source)
    at sun.security.ssl.SSLEngineImpl.readNetRecord(Unknown Source)
    at sun.security.ssl.SSLEngineImpl.unwrap(Unknown Source)
    at javax.net.ssl.SSLEngine.unwrap(Unknown Source)
    at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.fill(SslConnection.java:538)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:125)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:70)
    at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:130)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:116)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:269)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:97)
    at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:203)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:269)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:97)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
    at sun.security.ssl.Alerts.getSSLException(Unknown Source)
    at sun.security.ssl.SSLEngineImpl.fatal(Unknown Source)
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
    at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
    at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
    at sun.security.ssl.Handshaker.processLoop(Unknown Source)
    at sun.security.ssl.Handshaker$1.run(Unknown Source)
    at sun.security.ssl.Handshaker$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.security.ssl.Handshaker$DelegatedTask.run(Unknown Source)
    at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.fill(SslConnection.java:643)
    ... 13 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
    at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
    at sun.security.validator.Validator.validate(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
    ... 21 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
    at java.security.cert.CertPathBuilder.build(Unknown Source)
    ... 27 more
12:14:19.059 [qtp713656449-25] DEBUG o.eclipse.jetty.client.HttpReceiver - 
javax.net.ssl.SSLHandshakeException: General SSLEngine problem
    at sun.security.ssl.Handshaker.checkThrown(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.SSLEngineImpl.checkTaskThrown(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.SSLEngineImpl.readNetRecord(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.SSLEngineImpl.unwrap(Unknown Source) ~[na:1.8.0_151]
    at javax.net.ssl.SSLEngine.unwrap(Unknown Source) ~[na:1.8.0_151]
    at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.fill(SslConnection.java:538) ~[jetty-io-9.4.0.M1.jar:9.4.0.M1]
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:125) [jetty-client-9.4.0.M1.jar:9.4.0.M1]
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:70) [jetty-client-9.4.0.M1.jar:9.4.0.M1]
    at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:130) [jetty-client-9.4.0.M1.jar:9.4.0.M1]
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:116) [jetty-client-9.4.0.M1.jar:9.4.0.M1]
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:269) [jetty-io-9.4.0.M1.jar:9.4.0.M1]
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:97) [jetty-io-9.4.0.M1.jar:9.4.0.M1]
    at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:203) [jetty-io-9.4.0.M1.jar:9.4.0.M1]
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:269) [jetty-io-9.4.0.M1.jar:9.4.0.M1]
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:97) [jetty-io-9.4.0.M1.jar:9.4.0.M1]
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) [jetty-io-9.4.0.M1.jar:9.4.0.M1]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672) [jetty-util-9.4.0.M1.jar:9.4.0.M1]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590) [jetty-util-9.4.0.M1.jar:9.4.0.M1]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_151]
Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
    at sun.security.ssl.Alerts.getSSLException(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.SSLEngineImpl.fatal(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.Handshaker.processLoop(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.Handshaker$1.run(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.Handshaker$1.run(Unknown Source) ~[na:1.8.0_151]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_151]
    at sun.security.ssl.Handshaker$DelegatedTask.run(Unknown Source) ~[na:1.8.0_151]
    at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.fill(SslConnection.java:643) ~[jetty-io-9.4.0.M1.jar:9.4.0.M1]
    ... 13 common frames omitted
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(Unknown Source) ~[na:1.8.0_151]
    at sun.security.validator.PKIXValidator.engineValidate(Unknown Source) ~[na:1.8.0_151]
    at sun.security.validator.Validator.validate(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source) ~[na:1.8.0_151]
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source) ~[na:1.8.0_151]
    ... 21 common frames omitted
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source) ~[na:1.8.0_151]
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source) ~[na:1.8.0_151]
    at java.security.cert.CertPathBuilder.build(Unknown Source) ~[na:1.8.0_151]
    ... 27 common frames omitted
12:14:19.060 [qtp713656449-25] DEBUG o.eclipse.jetty.io.ssl.SslConnection - onFillable exit DecryptedEndPoint@50343bc0{lora.pub.lanvee.com/120.76.222.89:8080<->/192.168.4.177:49437,CLOSED,-|-,318/0,HttpConnectionOverHTTP@5fc35d5e}->SocketChannelEndPoint@2702ccdc{lora.pub.lanvee.com/120.76.222.89:8080<->/192.168.4.177:49437,CLOSED,-|-,50/0,SslConnection@73ef7c39}{io=0/0,kio=-1,kro=-1}
12:14:19.060 [qtp713656449-25] DEBUG o.e.j.util.thread.QueuedThreadPool - ran SocketChannelEndPoint@2702ccdc{lora.pub.lanvee.com/120.76.222.89:8080<->/192.168.4.177:49437,CLOSED,-|-,50/0,SslConnection@73ef7c39}{io=0/0,kio=-1,kro=-1}:runFillable
 

参考https://blog.csdn.net/gabriel576282253/article/details/81531746, 顺利解决

导入证书后,查 询如下:

keytool -list -keystore "C://Program Files/Java/jre1.8.0_151/lib/security/cacerts" | findstr /i lanvee_lora

如果导入成功,可以看到相关的信息

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值