CXF Developer created CAMEL-6992:
------------------------------------

             Summary: Camel-CXF->Webservice Client-> 2 consecutive web-service 
calls fail 
                 Key: CAMEL-6992
                 URL: https://issues.apache.org/jira/browse/CAMEL-6992
             Project: Camel
          Issue Type: Bug
          Components: camel-cxf
    Affects Versions: 2.12.1
         Environment: Tomcat 7, Windows 7
            Reporter: CXF Developer


 My case is as follows:

1) I have a web-application deployed on tomcat. In this web-application, I am 
consuming 2 web-services. These 2 web-services are invoked sequentially without 
any delay.
2) Important thing to note is that the endpoint URL of both these web-services 
have same host-name(IP) and same port number. Rest of the URL is different. 
(Both the URLs are plain HTTP. There is NO HTTPS)
3) First web-service is invoked. Camel-CXF processes and returns the response 
and starts a new thread for clean-up tasks. Lets call this new thread as 
'Clean-up Thread'. In this clean-up thread, the socket (which was created while 
invoking this first web-service) is closed. However, since this clean-up thread 
is started after the response is returned to my web-application code, the 2nd 
webservice call and the 'clean-up thread(cleaning up sockets created for 1st 
web-service)' execute simultaneously. And by the time, the actual 
"java.net.Socket.close()" method is called in the 'cleanup thread', the 2nd 
web-service invocation is already started using the SAME socket object.

Now, at this point, the clean-up thread closes the socket (which was created 
while invoking the first web-service). And since, the second web-service 
invocation is using the same socket object, the invocation of 2nd web-service 
terminates abruptly and the following exception is thrown:
: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:777)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:640)
at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1542)
at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1499)
at 
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:395)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

Please let me know if you are facing any issues while reproducing the issue. I 
will be more than happy to help.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to