cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Paquet (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CXF-7590) ConnectException in CXF WebClient logs the fault as FAULT_OUT
Date Fri, 15 Dec 2017 08:16:00 GMT

     [ https://issues.apache.org/jira/browse/CXF-7590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Olivier Paquet updated CXF-7590:
--------------------------------
    Description: 
Hi, 

If the cxf WebClient encounters a ConnectException and the LoggingFeature is registered, the
incoming message is logged as Type FAULT_OUT.

Wouldn't it be better/logical to set it to FAULT_IN ?


I attached a maven project to quickly reproduce this behaviour. If there is a reason why it's
logged like this please let me know.

{code}
INFO  15-12 09:08:42,502 (MarkerIgnoringBase.java:info:95)  -REQ_OUT
    Address: http://localhost:1234/test
    HttpMethod: GET
    ExchangeId: c94d047b-980f-402c-8978-737cce44d314
    Headers: {Accept=*/*}

WARN  15-12 09:08:43,520 (LogUtils.java:doLog:475)  -Interceptor for {http://localhost:1234/test}WebClient
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
	at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:683)
	at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1050)
	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:897)
	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:866)
	at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:334)
	at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:360)
	at org.paq.CXFRestClientTest.main(CXFRestClientTest.java:15)
Caused by: java.net.ConnectException: ConnectException invoking http://localhost:1234/test:
Connection refused: connect
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1387)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1371)
	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:56)
	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:216)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:658)
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	... 8 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
	at sun.net.www.http.HttpClient.New(HttpClient.java:308)
	at sun.net.www.http.HttpClient.New(HttpClient.java:326)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1181)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:377)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:373)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:373)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1584)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1612)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1557)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1358)
	... 13 more
INFO  15-12 09:08:43,535 (MarkerIgnoringBase.java:info:95)  -FAULT_OUT
    Address: http://localhost:1234/test
    HttpMethod: GET
    ExchangeId: c94d047b-980f-402c-8978-737cce44d314
    Headers: {Accept=*/*}
{code}

  was:
Hi, 

If the cxf WebClient encounters a ConnectException and the LoggingFeature is registered, the
incoming message is logged as Type FAULT_OUT.

Wouldn't it be better/logical to set it to FAULT_IN ?


I attached a maven project to quickly reproduce this behaviour.

{code}
INFO  15-12 09:08:42,502 (MarkerIgnoringBase.java:info:95)  -REQ_OUT
    Address: http://localhost:1234/test
    HttpMethod: GET
    ExchangeId: c94d047b-980f-402c-8978-737cce44d314
    Headers: {Accept=*/*}

WARN  15-12 09:08:43,520 (LogUtils.java:doLog:475)  -Interceptor for {http://localhost:1234/test}WebClient
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
	at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:683)
	at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1050)
	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:897)
	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:866)
	at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:334)
	at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:360)
	at org.paq.CXFRestClientTest.main(CXFRestClientTest.java:15)
Caused by: java.net.ConnectException: ConnectException invoking http://localhost:1234/test:
Connection refused: connect
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1387)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1371)
	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:56)
	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:216)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:658)
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	... 8 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
	at sun.net.www.http.HttpClient.New(HttpClient.java:308)
	at sun.net.www.http.HttpClient.New(HttpClient.java:326)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1181)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:377)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:373)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:373)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1584)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1612)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1557)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1358)
	... 13 more
INFO  15-12 09:08:43,535 (MarkerIgnoringBase.java:info:95)  -FAULT_OUT
    Address: http://localhost:1234/test
    HttpMethod: GET
    ExchangeId: c94d047b-980f-402c-8978-737cce44d314
    Headers: {Accept=*/*}
{code}


> ConnectException in CXF  WebClient logs the fault as FAULT_OUT
> --------------------------------------------------------------
>
>                 Key: CXF-7590
>                 URL: https://issues.apache.org/jira/browse/CXF-7590
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.2.1
>            Reporter: Olivier Paquet
>            Priority: Minor
>         Attachments: cxf-logging-sample.zip
>
>
> Hi, 
> If the cxf WebClient encounters a ConnectException and the LoggingFeature is registered,
the incoming message is logged as Type FAULT_OUT.
> Wouldn't it be better/logical to set it to FAULT_IN ?
> I attached a maven project to quickly reproduce this behaviour. If there is a reason
why it's logged like this please let me know.
> {code}
> INFO  15-12 09:08:42,502 (MarkerIgnoringBase.java:info:95)  -REQ_OUT
>     Address: http://localhost:1234/test
>     HttpMethod: GET
>     ExchangeId: c94d047b-980f-402c-8978-737cce44d314
>     Headers: {Accept=*/*}
> WARN  15-12 09:08:43,520 (LogUtils.java:doLog:475)  -Interceptor for {http://localhost:1234/test}WebClient
has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not send Message.
> 	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> 	at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:683)
> 	at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1050)
> 	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:897)
> 	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:866)
> 	at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:334)
> 	at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:360)
> 	at org.paq.CXFRestClientTest.main(CXFRestClientTest.java:15)
> Caused by: java.net.ConnectException: ConnectException invoking http://localhost:1234/test:
Connection refused: connect
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1387)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1371)
> 	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:56)
> 	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:216)
> 	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> 	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:658)
> 	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> 	... 8 more
> Caused by: java.net.ConnectException: Connection refused: connect
> 	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
> 	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
> 	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
> 	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
> 	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
> 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
> 	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
> 	at java.net.Socket.connect(Socket.java:589)
> 	at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
> 	at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
> 	at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
> 	at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
> 	at sun.net.www.http.HttpClient.New(HttpClient.java:308)
> 	at sun.net.www.http.HttpClient.New(HttpClient.java:326)
> 	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
> 	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1181)
> 	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
> 	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
> 	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
> 	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
> 	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
> 	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:377)
> 	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:373)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:373)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1584)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1612)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1557)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1358)
> 	... 13 more
> INFO  15-12 09:08:43,535 (MarkerIgnoringBase.java:info:95)  -FAULT_OUT
>     Address: http://localhost:1234/test
>     HttpMethod: GET
>     ExchangeId: c94d047b-980f-402c-8978-737cce44d314
>     Headers: {Accept=*/*}
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message