尝试通过http调用服务时遇到异常

时间:2018-08-30 08:57:24

标签: java http https

我只为Java httpclient 4.1.3注册http方案

schemeRegistry.register(new Scheme("http", host.getPort(), PlainSocketFactory.getSocketFactory()));

当尝试拨打某些http://blabla.bla的电话时,出现以下异常:

...
Caused by: org.apache.http.HttpException: Scheme 'https' not registered.
    at org.apache.http.impl.conn.DefaultHttpRoutePlanner.determineRoute(DefaultHttpRoutePlanner.java:109)
    at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:762)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:381)
    at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882)
    ... 8 more

我认为它与环境/端点有关,因为它仅在特定情况下不起作用。

对此,我将不胜感激。

0 个答案:

没有答案