[
https://issues.apache.org/jira/browse/CXF-3570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13045760#comment-13045760
]
David Liu commented on CXF-3570:
--------------------------------
Thanks Willem.
David
> HTTPConduit reads response before it completes sending request
> --------------------------------------------------------------
>
> Key: CXF-3570
> URL: https://issues.apache.org/jira/browse/CXF-3570
> Project: CXF
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.4
> Reporter: David Liu
> Priority: Critical
> Fix For: 2.4.1
>
>
> Hi,
> In CXF 2.4, HTTP Conduit has a new debug log as below. However, this
> logging message can cause HTTPConduit reads the response before it completes
> sending request, and it results in an IOException in the client side.
> The reason is that the method *connection.getContentType()* will trigger
> httpconnect to send current data to the HttpServer and want the server to
> return the response, so the server thinks the client complete the whole
> request and the server just reply nothing and closes the http connection.
> Code in HttpConduit.java
> {code}
> protected void onFirstWrite() throws IOException {
> ...
> if (LOG.isLoggable(Level.FINE)) {
> LOG.fine("Sending "
> + connection.getRequestMethod()
> + " Message with Headers to "
> + connection.getURL()
> + " Conduit :"
> + conduitName
> + "\nContent-Type: " + connection.getContentType() +
> "\n");
> }
> }
> {code}
> To reproduce the issue: please create a simple web service in cxf 2.4 and
> enable its debug log, and then use a generated proxy client to call the http
> service, then you can see the error below.
> David
> Exception:
> {code}
> Caused by: java.io.IOException: IOException invoking
> http://localhost:7777/Hello: Stream is closed
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
> Source)
> at java.lang.reflect.Constructor.newInstance(Unknown Source)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1385)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1370)
> at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:614)
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
> at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:484)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:414)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:269)
> at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
> ... 2 more
> {code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira