NutzCN Logo
问答 nut核心包 http工具 https post3 报错
发布于 2505天前 作者 wx_e4jchvgorn3d3900gcus 2843 次浏览 复制 上一个帖子 下一个帖子
标签:

在使用HTTPS时,报下面的错误。
试过Http.disableJvmHttpsCheck(); 返加是true,但是还是报错。

org.nutz.http.HttpException: url=https://med-biz.******.**.com/

	at org.nutz.http.sender.PostSender.send(PostSender.java:44)
	at org.nutz.http.Http.post3(Http.java:237)
	at org.nutz.http.Http.post3(Http.java:223)
	at com.orgine.onecard.prescription.hessian.service.TencentServiceTest.postData2Tencent(TencentServiceTest.java:123)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.nutz.mock.NutTestRunner.runChild(NutTestRunner.java:33)
	at org.nutz.mock.NutTestRunner.runChild(NutTestRunner.java:14)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.io.IOException: HTTPS hostname wrong:  should be <med-biz.*******.**.com>
	at sun.net.www.protocol.https.HttpsClient.checkURLSpoofing(HttpsClient.java:524)
	at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:448)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1014)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
	at org.nutz.http.Sender.getOutputStream(Sender.java:307)
	at org.nutz.http.sender.PostSender.send(PostSender.java:35)
	... 26 more
11 回复

自签名域名?? 配错证书了?

调用对方的https 接口报的错。

就是使用nutz 的 post工具类,来调用https的接口。

确定已经调用过?

Http.disableJvmHttpsCheck();

确定,打印出值了。

boolean result = Http.disableJvmHttpsCheck();

System.out.println(result ? "true" : "false");

打印的 true

//nutz
compile group: 'org.nutz', name: 'nutz', version: '1.r.63'

这个原因我知道了。不是代码存面的问题。已经报给合作方去修改SSL证书配置了。多谢wndal!

添加回复
请先登陆
回到顶部