[ 
https://issues.apache.org/jira/browse/CXF-5763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14020795#comment-14020795
 ] 

Anthony Communier commented on CXF-5763:
----------------------------------------

We do not use AsyncHttpClient any more because we observe that connection 
sometimes  has failure that are not excepted. Tests are runned with maven and 
soapui plugin (with contains jetty 6)

The connection abort is not seen in first log is not excepted


The code used to send the request :

WebClient wc = (WebClient) asyncService.getWebClient();    
wc.path("unsubscribe").accept(MediaType.APPLICATION_XML_TYPE).type(MediaType.APPLICATION_FORM_URLENCODED);

        List<NameValuePair> qparams = new ArrayList<NameValuePair>();
        qparams.add(new BasicNameValuePair(NOM_PARAM_ptfID, ptfID));
        qparams.add(new BasicNameValuePair(NOM_PARAM_GID, gid));
        qparams.add(new BasicNameValuePair(NOM_PARAM_REQUESTID, requestId));

        asyncService.executePost(Entity.text(URLEncodedUtils.format(qparams, 
Charset.defaultCharset())), callback);


When the callback reach the end of the processing : The method reset() is 
called on the AbstractClient (WebClient).
This method can be track with log : DEBUG c.c.c.w.c.s.WSClientAsyncSubsystem - 
return service :
It's done just after this log.

But in case of ClassCastException the reset method is called after (line 1833 
for the class cast and line 1856 for the reset).

The reset method is called because WebClient are put in a pool.

The issue could be more linked to fact that the connection is aborted. I don't 
know why the connection is aborted because it's never occurs when the 
AsyncPolicy is set to NEVER.

> ClassCast Exception in AsyncHTTPConduit$AsyncWrappedOutputStream.close() 
> method when using async and HttpAsyncClient 
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-5763
>                 URL: https://issues.apache.org/jira/browse/CXF-5763
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 3.0.0
>         Environment: Linux
> Java 7
>            Reporter: Anthony Communier
>            Assignee: Daniel Kulp
>         Attachments: TestUnsubscribeSM-output.txt, 
> com.capgemini.opentv.mediation.provisioning.customer.test.batchs.actions.statemachines.TestUnsubscribeSM-output.txt
>
>
> Sometimes there is an error on connection close when using async client 
> javax.ws.rs.ProcessingException: java.lang.ClassCastException: 
> org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream$1
>  cannot be cast to org.apache.cxf.io.CachedOutputStream
>       at 
> org.apache.cxf.jaxrs.client.WebClient.handleAsyncResponse(WebClient.java:1010)
>  [cxf-rt-rs-client-3.0.0.jar:3.0.0]
>       at org.apache.cxf.jaxrs.client.WebClient.access$100(WebClient.java:81) 
> [cxf-rt-rs-client-3.0.0.jar:3.0.0]
>       at 
> org.apache.cxf.jaxrs.client.WebClient$ClientAsyncResponseInterceptor.handleMessage(WebClient.java:1298)
>  ~[cxf-rt-rs-client-3.0.0.jar:3.0.0]
>       at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
>  ~[cxf-core-3.0.0.jar:3.0.0]
>       at 
> org.apache.cxf.jaxrs.client.ClientMessageObserver.onMessage(ClientMessageObserver.java:56)
>  ~[cxf-rt-rs-client-3.0.0.jar:3.0.0]
>       at 
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1154)
>  ~[cxf-rt-transports-http-3.0.0.jar:3.0.0]
>       at 
> org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
>  ~[cxf-core-3.0.0.jar:3.0.0]
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  ~[na:1.7.0_25]
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  ~[na:1.7.0_25]
>       at 
> org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
>  ~[cxf-core-3.0.0.jar:3.0.0]
>       at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
> Caused by: java.lang.ClassCastException: 
> org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream$1
>  cannot be cast to org.apache.cxf.io.CachedOutputStream
>       at 
> org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream.close(AsyncHTTPConduit.java:397)
>  ~[cxf-rt-transports-http-hc-3.0.0.jar:3.0.0]
>       at 
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) 
> ~[cxf-core-3.0.0.jar:3.0.0]
>       at 
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:638) 
> ~[cxf-rt-transports-http-3.0.0.jar:3.0.0]
>       at 
> org.apache.cxf.endpoint.AbstractConduitSelector.complete(AbstractConduitSelector.java:209)
>  ~[cxf-core-3.0.0.jar:3.0.0]
>       at 
> org.apache.cxf.jaxrs.client.AbstractClient.preProcessResult(AbstractClient.java:534)
>  ~[cxf-rt-rs-client-3.0.0.jar:3.0.0]
>       at 
> org.apache.cxf.jaxrs.client.WebClient.handleAsyncResponse(WebClient.java:1005)
>  [cxf-rt-rs-client-3.0.0.jar:3.0.0]
>       ... 10 common frames omitted



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to