httpclient.excute方法报空指针,求好心人帮忙

请求接口的时候用的httpclient, 程序在本地跑没问题,在线上服务器也没问题,可以正常请求各个接口。

本来测试服务器也是可以的,但是有天突然开始发生下面的情况:

如果请求一个ip,第一次可以,但是第二次请求这个ip的其他接口时就会报空指针异常
java.lang.NullPointerException
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java)

这是请求那块的代码:

 public static HttpResp perform(HttpReq req) throws Exception {

        RequestConfig globalConfig = RequestConfig.custom().setConnectTimeout(5000).setSocketTimeout(5000).build();

        CloseableHttpClient httpClient =HttpClients.custom().setDefaultRequestConfig(globalConfig).build();
        HttpResp resp = null;
        HttpRequestBase request = buildHttpRequest(req);

        HttpResponse response = httpClient.execute(request);
        resp = buildHttpResponse(response);
        return resp;

    }

求好心人帮忙看看。。。。

http://www.2cto.com/kf/201312/263762.html