Hi Sergey, At runtime, in Debug mode Changed the response.stream.auto.close=false. Later on , i am not facing the Entity Not available Exception.
Is there any impact on the performance when we disabled the flag? On Wed, Aug 16, 2017 at 3:32 AM, Sergey Beryozkin [via CXF] < [email protected]> wrote: > Hi > > I don't quite understand what the issue is, does it happen when you > enable "response.stream.auto.close" ? If yes - what happens if you do > not enable this property ? > > CXF does not auto-close the input stream by default given of the few > well-known side-effects. > > Given you have already tried to debug - it is better to set a breakpoint > inside org.apache.cxf.jaxrs.impl.ResponseImpl - there you will see why > InputStream is not available in your case > > Cheers, Sergey > > On 15/08/17 23:20, sbalustar wrote: > > > HI sergey, We are upgrading CXF version 2.7.7 to 3.1.8 and facing the > below > > issue. > > > > AUDIT:2017-08-15 11:31:11.047:localhost-startStop-1:"Caused by > > javax.ws.rs.ProcessingException: java.lang.IllegalStateException: > Entity is > > not available > > at > > org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1141) > > > at > > org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1110) > > > at > > org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1035) > > > at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:892) > > > at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:863) > > > at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:413) > > > at > > com.walmart.platform.soa.client.RestClient.invoke(RestClient.java:261) > > ... 78 more > > > > I have gone through this ticket > > https://issues.apache.org/jira/browse/CXF-5144 which you mentioned that > Set > > this property: "response.stream.auto.close" to true. This is done even > > though we are getting the same issue. > > > > When i debug the code, in WebClient.invoke method this exception is > occured. > > > > protected Response handleResponse(Message outMessage, Class<?> > > responseClass, Type genericType) { > > try { > > ResponseBuilder rb = setResponseBuilder(outMessage, > > outMessage.getExchange()); > > Response currentResponse = rb.clone().build(); > > ((ResponseImpl)currentResponse).setOutMessage(outMessage); > > > > Object entity = readBody(currentResponse, outMessage, > > responseClass, genericType, > > new Annotation[]{}); > > > > if (entity == null) { > > int status = currentResponse.getStatus(); > > if (status >= 400) { > > entity = currentResponse.getEntity(); > > } > > } > > rb = JAXRSUtils.fromResponse(currentResponse); > > > > rb.entity(entity instanceof Response > > ? ((Response)entity).getEntity() : entity); > > > > Response r = rb.build(); > > getState().setResponse(r); > > ((ResponseImpl)r).setOutMessage(outMessage); > > return r; > > } catch (Throwable ex) { > > throw (ex instanceof ProcessingException) ? > > (ProcessingException)ex > > : new > > ProcessingException(ex); > > } finally { > > > > ClientProviderFactory.getInstance(outMessage).clearThreadLocalProxies(); > > > } > > } > > > > > > public static ResponseBuilder fromResponse(Response response) { > > ResponseBuilder rb = toResponseBuilder(response.getStatus()); > > * rb.entity(response.getEntity()); > > * for (Map.Entry<String, List<Object>> entry : > > response.getMetadata().entrySet()) { > > List values = entry.getValue(); > > for (Object value : values) { > > rb.header(entry.getKey(), value); > > } > > } > > return rb; > > } > > > > * rb.entity(response.getEntity()); > > * seems like , entity is null in ResponseBuilder rb from the > fromResponse > > method. > > > > Please let me know, what could be the solution to fix this issue? > > > > > > > > -- > > View this message in context: http://cxf.547215.n5.nabble. > com/Closing-of-WebClient-and-Response-objects-tp5748134p5782716.html > > Sent from the cxf-user mailing list archive at Nabble.com. > > > > > -- > Sergey Beryozkin > > Talend Community Coders > http://coders.talend.com/ > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > http://cxf.547215.n5.nabble.com/Closing-of-WebClient-and-Response-objects- > tp5748134p5782725.html > To unsubscribe from Closing of WebClient and Response objects, click here > <http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5748134&code=YnN1ZGFiYXRodWxhQGdtYWlsLmNvbXw1NzQ4MTM0fDEyODI4MTYwNTM=> > . > NAML > <http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://cxf.547215.n5.nabble.com/Closing-of-WebClient-and-Response-objects-tp5748134p5782748.html Sent from the cxf-user mailing list archive at Nabble.com.
