请求https错误: unable to find valid certification path to requested target
来源:互联网 发布:王士营养配餐软件 编辑:程序博客网 时间:2024/05/16 15:51
错误及原因
当Java客户端请求实现https协议的服务时,出现异常:’unable to find valid certification path to requested target’
是因为服务期端的证书没有被认证,需要做的是把服务端证书导入到Java keystore。
解决方法
使用下面的类安装证书
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
该类为包含main方法的入口类,直接运行即可。
在出现提示后,输入1后回车完成(如果你要放弃并退出输入q即可)。
执行完毕后,在执行该类的当然目录中找到生成的 jssecacerts 文件,然后拷贝该文件到JDK中,如我的是放到:……\jdk1.8.0_60\jre\lib\security 中。
最后再使用之前的Java代码请求HTTPS接口,就不会出现错误了。
阅读全文
0 0
- 请求https错误: unable to find valid certification path to requested target
- 请求https错误: unable to find valid certification path to requested target
- https请求报错解决: unable to find valid certification path to requested target
- unable to find valid certification path to requested target'解决办法
- unable to find valid certification path to requested target
- unable to find valid certification path to requested target
- SunCertPathBuilderException: Unable To Find Valid Certification Path To Requested Target
- Unable to find valid certification path to requested target
- SunCertPathBuilderException: unable to find valid certification path to requested target
- unable to find valid certification path to requested target
- 彻底解决unable to find valid certification path to requested target
- 20170704unable to find valid certification path to requested target
- Java进行https请求需要证书的问题 unable to find valid certification path to requested target
- 使用restful请求https身份不通过, unable to find valid certification path to requested target,使用java生成签名证书
- 现https协议的服务异常:'unable to find valid certification path to requested target'
- HTTPS中SunCertPathBuilderException: unable to find valid certification path to requested target
- Apache HttpClient请求 unable to find valid certification path to requested target解决方案
- 解决错误:unable to find valid certification path to requested target
- [TensorFlow] demo1 创建100个float32的随机数x_data
- Java并发编程:CountDownLatch、CyclicBarrier和 Semaphore
- JSF 2.0 command button 为‘null Converter’设置值“......“时发生转换错误。
- linux 下安装python3
- 防止帐号重复登录,本地有效
- 请求https错误: unable to find valid certification path to requested target
- android view的讲解 之 view的工作流程(measure,layout,draw)(二)
- python 购物车程序 作业2
- Jenkins-工作区清理插件
- SDUT 1272 面向对象程序设计上机练习十(运算符重载)
- centos7 gitlab安装
- 如何治疗腰间盘突出?
- NOIP 提高组 2010 关押罪犯
- kafka推送消息, producer没有对应记录