com.sun.jersey.api.client.ClientHandlerException:java.io.IOException:stream已关闭

时间:2017-08-23 16:13:52

标签: java rest jersey

我将此错误视为我的球衣客户端的一部分。以下是错误和代码段。请你能告诉我潜在的原因吗?

Caused by: com.sun.jersey.api.client.ClientHandlerException: java.io.IOException: stream is closed
        at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:644)
        at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:586)
        at flow.subflow.GetByConsentID.getServiceByConsentID.servletImplementation(getServiceByConsentID.java:118)
        at com.avaya.sce.runtime.BasicServlet.handleRequest(BasicServlet.java:112)
        at com.avaya.sce.runtime.AppServlet.processRequest(AppServlet.java:96)
        ... 348 more Caused by: java.io.IOException: stream is closed
        at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.ensureOpen(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source)
        at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
        at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
        at sun.nio.cs.StreamDecoder.read(Unknown Source)
        at java.io.InputStreamReader.read(Unknown Source)

以下是我的代码 -

    Client client = (Client)mySession.getVariableField(IProjectVariables.SERVICE_CLIENT).getObjectValue();
    WebResource webResource = client.resource(epr);

    QueryRequest request = new QueryRequest();

    //Set up query params
    MultivaluedMap queryParams = new MultivaluedMapImpl();
    queryParams.add("consentId", mySession.getVariableField(IProjectVariables.CONSENT_INFO, IProjectVariables.CONSENT_INFO_FIELD_CONSENT_ID).getStringValue());

    response = webResource.type("application/json")
            .header("Authorization", mySession.getVariableField(IProjectVariables.HEADER, IProjectVariables.HEADER_FIELD_AUTHORIZATION).getStringValue())
            .header("timestamp", mySession.getVariableField(IProjectVariables.HEADER, IProjectVariables.HEADER_FIELD_TIMESTAMP).getStringValue())
            .get(ClientResponse.class);
    GetResponse getResponse = response.getEntity(GetResponse.class);

0 个答案:

没有答案