Suppress CXF Exception

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Suppress CXF Exception

ivanjunckes
Hey guys,

I get this when using cxf microprofile impl, is there anyway to suppress
this cxf exception, I would like to do proper error handling and I don't
want it to be printed on my logs.

out 13, 2018 12:18:22 PM org.apache.cxf.phase.PhaseInterceptorChain
doDefaultLogging
WARNING: Interceptor for {
http://interfaces.client.rest.movie.inget.tomitribe.org/}MoviesResourceClient
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:67)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at
org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:710)
at
org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:778)
at
org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:238)
at com.sun.proxy.$Proxy23.getMovies(Unknown Source)
at
org.tomitribe.inget.movie.rest.cmd.MoviesGetMoviesCmd.run(MoviesGetMoviesCmd.java:15)
at
org.tomitribe.inget.movie.rest.cmd.base.DefaultCommand.run(DefaultCommand.java:33)
at org.tomitribe.inget.movie.rest.cmd.base.MainCli.main(MainCli.java:28)
Caused by: java.net.ConnectException: ConnectException invoking
http://localhost:8080/2695af99-a59e-4095-9f0c-0b01f122f0e4/movies:
Connection refused (Connection refused)
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:1402)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1386)
at
org.apache.cxf.io.AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:673)
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63)
... 8 more
Caused by: java.net.ConnectException: Connection refused (Connection
refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
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.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:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
at
sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1199)
at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
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:1599)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1627)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1572)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1373)
... 12 more
Reply | Threaded
Open this post in threaded view
|

Re: Suppress CXF Exception

Romain Manni-Bucau
Hi Ivan

you can either configure the log level or set a FaultListener to handle
that and bypass the default log.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le sam. 13 oct. 2018 à 17:21, Ivan Junckes Filho <[hidden email]> a
écrit :

> Hey guys,
>
> I get this when using cxf microprofile impl, is there anyway to suppress
> this cxf exception, I would like to do proper error handling and I don't
> want it to be printed on my logs.
>
> out 13, 2018 12:18:22 PM org.apache.cxf.phase.PhaseInterceptorChain
> doDefaultLogging
> WARNING: Interceptor for {
>
> http://interfaces.client.rest.movie.inget.tomitribe.org/}MoviesResourceClient
> has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not send Message.
> at
>
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:67)
> at
>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> at
>
> org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:710)
> at
>
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:778)
> at
>
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:238)
> at com.sun.proxy.$Proxy23.getMovies(Unknown Source)
> at
>
> org.tomitribe.inget.movie.rest.cmd.MoviesGetMoviesCmd.run(MoviesGetMoviesCmd.java:15)
> at
>
> org.tomitribe.inget.movie.rest.cmd.base.DefaultCommand.run(DefaultCommand.java:33)
> at org.tomitribe.inget.movie.rest.cmd.base.MainCli.main(MainCli.java:28)
> Caused by: java.net.ConnectException: ConnectException invoking
> http://localhost:8080/2695af99-a59e-4095-9f0c-0b01f122f0e4/movies:
> Connection refused (Connection refused)
> 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:1402)
> at
>
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1386)
> at
> org.apache.cxf.io
> .AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77)
> at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:673)
> at
>
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63)
> ... 8 more
> Caused by: java.net.ConnectException: Connection refused (Connection
> refused)
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> 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.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:463)
> at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
> at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
> at sun.net.www.http.HttpClient.New(HttpClient.java:339)
> at sun.net.www.http.HttpClient.New(HttpClient.java:357)
> at
>
> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
> at
>
> sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1199)
> at
>
> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
> at
>
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
> at
>
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
> at
>
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
> 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:1599)
> at
>
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1627)
> at
>
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1572)
> at
>
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1373)
> ... 12 more
>
Reply | Threaded
Open this post in threaded view
|

Re: Suppress CXF Exception

ivanjunckes
I tried this and doesn't seem to work.

 RestClientBuilder builder = null;
 builder.property("org.apache.cxf.logging.FaultListener", new
NoOpFaultListener());

Is this wrong?

On Sat, Oct 13, 2018 at 12:47 PM Romain Manni-Bucau <[hidden email]>
wrote:

> Hi Ivan
>
> you can either configure the log level or set a FaultListener to handle
> that and bypass the default log.
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://rmannibucau.metawerx.net/> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> <
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> >
>
>
> Le sam. 13 oct. 2018 à 17:21, Ivan Junckes Filho <[hidden email]> a
> écrit :
>
> > Hey guys,
> >
> > I get this when using cxf microprofile impl, is there anyway to suppress
> > this cxf exception, I would like to do proper error handling and I don't
> > want it to be printed on my logs.
> >
> > out 13, 2018 12:18:22 PM org.apache.cxf.phase.PhaseInterceptorChain
> > doDefaultLogging
> > WARNING: Interceptor for {
> >
> >
> http://interfaces.client.rest.movie.inget.tomitribe.org/}MoviesResourceClient
> > has thrown exception, unwinding now
> > org.apache.cxf.interceptor.Fault: Could not send Message.
> > at
> >
> >
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:67)
> > at
> >
> >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> > at
> >
> >
> org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:710)
> > at
> >
> >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:778)
> > at
> >
> >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:238)
> > at com.sun.proxy.$Proxy23.getMovies(Unknown Source)
> > at
> >
> >
> org.tomitribe.inget.movie.rest.cmd.MoviesGetMoviesCmd.run(MoviesGetMoviesCmd.java:15)
> > at
> >
> >
> org.tomitribe.inget.movie.rest.cmd.base.DefaultCommand.run(DefaultCommand.java:33)
> > at org.tomitribe.inget.movie.rest.cmd.base.MainCli.main(MainCli.java:28)
> > Caused by: java.net.ConnectException: ConnectException invoking
> > http://localhost:8080/2695af99-a59e-4095-9f0c-0b01f122f0e4/movies:
> > Connection refused (Connection refused)
> > 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:1402)
> > at
> >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1386)
> > at
> > org.apache.cxf.io
> > .AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77)
> > at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> > at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:673)
> > at
> >
> >
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63)
> > ... 8 more
> > Caused by: java.net.ConnectException: Connection refused (Connection
> > refused)
> > at java.net.PlainSocketImpl.socketConnect(Native Method)
> > 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.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:463)
> > at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
> > at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
> > at sun.net.www.http.HttpClient.New(HttpClient.java:339)
> > at sun.net.www.http.HttpClient.New(HttpClient.java:357)
> > at
> >
> >
> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
> > at
> >
> >
> sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1199)
> > at
> >
> >
> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
> > at
> >
> >
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
> > at
> >
> >
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
> > at
> >
> >
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
> > 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:1599)
> > at
> >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1627)
> > at
> >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1572)
> > at
> >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1373)
> > ... 12 more
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Suppress CXF Exception

Romain Manni-Bucau
this property is ignored by the MP layer, you have to use a cxf interceptor:

@OutInterceptors(classes = MyInterceptor.class)
@Path("foo")
public interface MyApi {
    @GET
    String get();
}

public class MyInterceptor extends AbstractPhaseInterceptor<Message> {
    public MyInterceptor() {
        super(Phase.PRE_LOGICAL);
    }

    public void handleMessage(final Message message) throws Fault {
        message.put(FaultListener.class.getName(), new NoOpFaultListener());
    }

    public void handleFault(final Message message) {
        // no-op
    }
}


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le sam. 13 oct. 2018 à 18:31, Ivan Junckes Filho <[hidden email]> a
écrit :

> I tried this and doesn't seem to work.
>
>  RestClientBuilder builder = null;
>  builder.property("org.apache.cxf.logging.FaultListener", new
> NoOpFaultListener());
>
> Is this wrong?
>
> On Sat, Oct 13, 2018 at 12:47 PM Romain Manni-Bucau <[hidden email]
> >
> wrote:
>
> > Hi Ivan
> >
> > you can either configure the log level or set a FaultListener to handle
> > that and bypass the default log.
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://rmannibucau.metawerx.net/> | Old Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> > <
> >
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> > >
> >
> >
> > Le sam. 13 oct. 2018 à 17:21, Ivan Junckes Filho <[hidden email]>
> a
> > écrit :
> >
> > > Hey guys,
> > >
> > > I get this when using cxf microprofile impl, is there anyway to
> suppress
> > > this cxf exception, I would like to do proper error handling and I
> don't
> > > want it to be printed on my logs.
> > >
> > > out 13, 2018 12:18:22 PM org.apache.cxf.phase.PhaseInterceptorChain
> > > doDefaultLogging
> > > WARNING: Interceptor for {
> > >
> > >
> >
> http://interfaces.client.rest.movie.inget.tomitribe.org/}MoviesResourceClient
> > > has thrown exception, unwinding now
> > > org.apache.cxf.interceptor.Fault: Could not send Message.
> > > at
> > >
> > >
> >
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:67)
> > > at
> > >
> > >
> >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> > > at
> > >
> > >
> >
> org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:710)
> > > at
> > >
> > >
> >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:778)
> > > at
> > >
> > >
> >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:238)
> > > at com.sun.proxy.$Proxy23.getMovies(Unknown Source)
> > > at
> > >
> > >
> >
> org.tomitribe.inget.movie.rest.cmd.MoviesGetMoviesCmd.run(MoviesGetMoviesCmd.java:15)
> > > at
> > >
> > >
> >
> org.tomitribe.inget.movie.rest.cmd.base.DefaultCommand.run(DefaultCommand.java:33)
> > > at
> org.tomitribe.inget.movie.rest.cmd.base.MainCli.main(MainCli.java:28)
> > > Caused by: java.net.ConnectException: ConnectException invoking
> > > http://localhost:8080/2695af99-a59e-4095-9f0c-0b01f122f0e4/movies:
> > > Connection refused (Connection refused)
> > > 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:1402)
> > > at
> > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1386)
> > > at
> > > org.apache.cxf.io
> > > .AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77)
> > > at
> > org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> > > at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:673)
> > > at
> > >
> > >
> >
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63)
> > > ... 8 more
> > > Caused by: java.net.ConnectException: Connection refused (Connection
> > > refused)
> > > at java.net.PlainSocketImpl.socketConnect(Native Method)
> > > 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.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:463)
> > > at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
> > > at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
> > > at sun.net.www.http.HttpClient.New(HttpClient.java:339)
> > > at sun.net.www.http.HttpClient.New(HttpClient.java:357)
> > > at
> > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
> > > at
> > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1199)
> > > at
> > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
> > > at
> > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
> > > at
> > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
> > > at
> > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
> > > 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:1599)
> > > at
> > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1627)
> > > at
> > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1572)
> > > at
> > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1373)
> > > ... 12 more
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Suppress CXF Exception

ivanjunckes
Thanks Romain, it works. Is there anyway to make this work without having
to annotate the client?

Is the property being ignored a bug in mp impl?


On Sat, Oct 13, 2018 at 1:57 PM Romain Manni-Bucau <[hidden email]>
wrote:

> this property is ignored by the MP layer, you have to use a cxf
> interceptor:
>
> @OutInterceptors(classes = MyInterceptor.class)
> @Path("foo")
> public interface MyApi {
>     @GET
>     String get();
> }
>
> public class MyInterceptor extends AbstractPhaseInterceptor<Message> {
>     public MyInterceptor() {
>         super(Phase.PRE_LOGICAL);
>     }
>
>     public void handleMessage(final Message message) throws Fault {
>         message.put(FaultListener.class.getName(), new
> NoOpFaultListener());
>     }
>
>     public void handleFault(final Message message) {
>         // no-op
>     }
> }
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://rmannibucau.metawerx.net/> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> <
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> >
>
>
> Le sam. 13 oct. 2018 à 18:31, Ivan Junckes Filho <[hidden email]> a
> écrit :
>
> > I tried this and doesn't seem to work.
> >
> >  RestClientBuilder builder = null;
> >  builder.property("org.apache.cxf.logging.FaultListener", new
> > NoOpFaultListener());
> >
> > Is this wrong?
> >
> > On Sat, Oct 13, 2018 at 12:47 PM Romain Manni-Bucau <
> [hidden email]
> > >
> > wrote:
> >
> > > Hi Ivan
> > >
> > > you can either configure the log level or set a FaultListener to handle
> > > that and bypass the default log.
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <https://rmannibucau.metawerx.net/> | Old Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> > > https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> > > <
> > >
> >
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> > > >
> > >
> > >
> > > Le sam. 13 oct. 2018 à 17:21, Ivan Junckes Filho <
> [hidden email]>
> > a
> > > écrit :
> > >
> > > > Hey guys,
> > > >
> > > > I get this when using cxf microprofile impl, is there anyway to
> > suppress
> > > > this cxf exception, I would like to do proper error handling and I
> > don't
> > > > want it to be printed on my logs.
> > > >
> > > > out 13, 2018 12:18:22 PM org.apache.cxf.phase.PhaseInterceptorChain
> > > > doDefaultLogging
> > > > WARNING: Interceptor for {
> > > >
> > > >
> > >
> >
> http://interfaces.client.rest.movie.inget.tomitribe.org/}MoviesResourceClient
> > > > has thrown exception, unwinding now
> > > > org.apache.cxf.interceptor.Fault: Could not send Message.
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:67)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:710)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:778)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:238)
> > > > at com.sun.proxy.$Proxy23.getMovies(Unknown Source)
> > > > at
> > > >
> > > >
> > >
> >
> org.tomitribe.inget.movie.rest.cmd.MoviesGetMoviesCmd.run(MoviesGetMoviesCmd.java:15)
> > > > at
> > > >
> > > >
> > >
> >
> org.tomitribe.inget.movie.rest.cmd.base.DefaultCommand.run(DefaultCommand.java:33)
> > > > at
> > org.tomitribe.inget.movie.rest.cmd.base.MainCli.main(MainCli.java:28)
> > > > Caused by: java.net.ConnectException: ConnectException invoking
> > > > http://localhost:8080/2695af99-a59e-4095-9f0c-0b01f122f0e4/movies:
> > > > Connection refused (Connection refused)
> > > > 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:1402)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1386)
> > > > at
> > > > org.apache.cxf.io
> > > >
> .AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77)
> > > > at
> > > org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> > > > at
> > org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:673)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63)
> > > > ... 8 more
> > > > Caused by: java.net.ConnectException: Connection refused (Connection
> > > > refused)
> > > > at java.net.PlainSocketImpl.socketConnect(Native Method)
> > > > 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.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:463)
> > > > at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
> > > > at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
> > > > at sun.net.www.http.HttpClient.New(HttpClient.java:339)
> > > > at sun.net.www.http.HttpClient.New(HttpClient.java:357)
> > > > at
> > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
> > > > at
> > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1199)
> > > > at
> > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
> > > > at
> > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
> > > > at
> > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
> > > > at
> > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
> > > > 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:1599)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1627)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1572)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1373)
> > > > ... 12 more
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Suppress CXF Exception

Romain Manni-Bucau
Le sam. 13 oct. 2018 à 19:11, Ivan Junckes Filho <[hidden email]> a
écrit :

> Thanks Romain, it works. Is there anyway to make this work without having
> to annotate the client?
>

i dont think so


>
> Is the property being ignored a bug in mp impl?
>

Yes and in the client as well AFAIK


>
>
> On Sat, Oct 13, 2018 at 1:57 PM Romain Manni-Bucau <[hidden email]>
> wrote:
>
> > this property is ignored by the MP layer, you have to use a cxf
> > interceptor:
> >
> > @OutInterceptors(classes = MyInterceptor.class)
> > @Path("foo")
> > public interface MyApi {
> >     @GET
> >     String get();
> > }
> >
> > public class MyInterceptor extends AbstractPhaseInterceptor<Message> {
> >     public MyInterceptor() {
> >         super(Phase.PRE_LOGICAL);
> >     }
> >
> >     public void handleMessage(final Message message) throws Fault {
> >         message.put(FaultListener.class.getName(), new
> > NoOpFaultListener());
> >     }
> >
> >     public void handleFault(final Message message) {
> >         // no-op
> >     }
> > }
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://rmannibucau.metawerx.net/> | Old Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> > <
> >
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> > >
> >
> >
> > Le sam. 13 oct. 2018 à 18:31, Ivan Junckes Filho <[hidden email]>
> a
> > écrit :
> >
> > > I tried this and doesn't seem to work.
> > >
> > >  RestClientBuilder builder = null;
> > >  builder.property("org.apache.cxf.logging.FaultListener", new
> > > NoOpFaultListener());
> > >
> > > Is this wrong?
> > >
> > > On Sat, Oct 13, 2018 at 12:47 PM Romain Manni-Bucau <
> > [hidden email]
> > > >
> > > wrote:
> > >
> > > > Hi Ivan
> > > >
> > > > you can either configure the log level or set a FaultListener to
> handle
> > > > that and bypass the default log.
> > > >
> > > > Romain Manni-Bucau
> > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > <https://rmannibucau.metawerx.net/> | Old Blog
> > > > <http://rmannibucau.wordpress.com> | Github <
> > > > https://github.com/rmannibucau> |
> > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> > > > <
> > > >
> > >
> >
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> > > > >
> > > >
> > > >
> > > > Le sam. 13 oct. 2018 à 17:21, Ivan Junckes Filho <
> > [hidden email]>
> > > a
> > > > écrit :
> > > >
> > > > > Hey guys,
> > > > >
> > > > > I get this when using cxf microprofile impl, is there anyway to
> > > suppress
> > > > > this cxf exception, I would like to do proper error handling and I
> > > don't
> > > > > want it to be printed on my logs.
> > > > >
> > > > > out 13, 2018 12:18:22 PM org.apache.cxf.phase.PhaseInterceptorChain
> > > > > doDefaultLogging
> > > > > WARNING: Interceptor for {
> > > > >
> > > > >
> > > >
> > >
> >
> http://interfaces.client.rest.movie.inget.tomitribe.org/}MoviesResourceClient
> > > > > has thrown exception, unwinding now
> > > > > org.apache.cxf.interceptor.Fault: Could not send Message.
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:67)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:710)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:778)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:238)
> > > > > at com.sun.proxy.$Proxy23.getMovies(Unknown Source)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.tomitribe.inget.movie.rest.cmd.MoviesGetMoviesCmd.run(MoviesGetMoviesCmd.java:15)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.tomitribe.inget.movie.rest.cmd.base.DefaultCommand.run(DefaultCommand.java:33)
> > > > > at
> > > org.tomitribe.inget.movie.rest.cmd.base.MainCli.main(MainCli.java:28)
> > > > > Caused by: java.net.ConnectException: ConnectException invoking
> > > > > http://localhost:8080/2695af99-a59e-4095-9f0c-0b01f122f0e4/movies:
> > > > > Connection refused (Connection refused)
> > > > > 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:1402)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1386)
> > > > > at
> > > > > org.apache.cxf.io
> > > > >
> > .AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77)
> > > > > at
> > > >
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> > > > > at
> > > org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:673)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63)
> > > > > ... 8 more
> > > > > Caused by: java.net.ConnectException: Connection refused
> (Connection
> > > > > refused)
> > > > > at java.net.PlainSocketImpl.socketConnect(Native Method)
> > > > > 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.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:463)
> > > > > at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
> > > > > at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
> > > > > at sun.net.www.http.HttpClient.New(HttpClient.java:339)
> > > > > at sun.net.www.http.HttpClient.New(HttpClient.java:357)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1199)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
> > > > > 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:1599)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1627)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1572)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1373)
> > > > > ... 12 more
> > > > >
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Suppress CXF Exception

ivanjunckes
Thanks a lot for your help Romain.

On Sat, Oct 13, 2018 at 4:32 PM Romain Manni-Bucau <[hidden email]>
wrote:

> Le sam. 13 oct. 2018 à 19:11, Ivan Junckes Filho <[hidden email]> a
> écrit :
>
> > Thanks Romain, it works. Is there anyway to make this work without having
> > to annotate the client?
> >
>
> i dont think so
>
>
> >
> > Is the property being ignored a bug in mp impl?
> >
>
> Yes and in the client as well AFAIK
>
>
> >
> >
> > On Sat, Oct 13, 2018 at 1:57 PM Romain Manni-Bucau <
> [hidden email]>
> > wrote:
> >
> > > this property is ignored by the MP layer, you have to use a cxf
> > > interceptor:
> > >
> > > @OutInterceptors(classes = MyInterceptor.class)
> > > @Path("foo")
> > > public interface MyApi {
> > >     @GET
> > >     String get();
> > > }
> > >
> > > public class MyInterceptor extends AbstractPhaseInterceptor<Message> {
> > >     public MyInterceptor() {
> > >         super(Phase.PRE_LOGICAL);
> > >     }
> > >
> > >     public void handleMessage(final Message message) throws Fault {
> > >         message.put(FaultListener.class.getName(), new
> > > NoOpFaultListener());
> > >     }
> > >
> > >     public void handleFault(final Message message) {
> > >         // no-op
> > >     }
> > > }
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <https://rmannibucau.metawerx.net/> | Old Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> > > https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> > > <
> > >
> >
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> > > >
> > >
> > >
> > > Le sam. 13 oct. 2018 à 18:31, Ivan Junckes Filho <
> [hidden email]>
> > a
> > > écrit :
> > >
> > > > I tried this and doesn't seem to work.
> > > >
> > > >  RestClientBuilder builder = null;
> > > >  builder.property("org.apache.cxf.logging.FaultListener", new
> > > > NoOpFaultListener());
> > > >
> > > > Is this wrong?
> > > >
> > > > On Sat, Oct 13, 2018 at 12:47 PM Romain Manni-Bucau <
> > > [hidden email]
> > > > >
> > > > wrote:
> > > >
> > > > > Hi Ivan
> > > > >
> > > > > you can either configure the log level or set a FaultListener to
> > handle
> > > > > that and bypass the default log.
> > > > >
> > > > > Romain Manni-Bucau
> > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > <https://rmannibucau.metawerx.net/> | Old Blog
> > > > > <http://rmannibucau.wordpress.com> | Github <
> > > > > https://github.com/rmannibucau> |
> > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> > > > > <
> > > > >
> > > >
> > >
> >
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> > > > > >
> > > > >
> > > > >
> > > > > Le sam. 13 oct. 2018 à 17:21, Ivan Junckes Filho <
> > > [hidden email]>
> > > > a
> > > > > écrit :
> > > > >
> > > > > > Hey guys,
> > > > > >
> > > > > > I get this when using cxf microprofile impl, is there anyway to
> > > > suppress
> > > > > > this cxf exception, I would like to do proper error handling and
> I
> > > > don't
> > > > > > want it to be printed on my logs.
> > > > > >
> > > > > > out 13, 2018 12:18:22 PM
> org.apache.cxf.phase.PhaseInterceptorChain
> > > > > > doDefaultLogging
> > > > > > WARNING: Interceptor for {
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://interfaces.client.rest.movie.inget.tomitribe.org/}MoviesResourceClient
> > > > > > has thrown exception, unwinding now
> > > > > > org.apache.cxf.interceptor.Fault: Could not send Message.
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:67)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:710)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:778)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:238)
> > > > > > at com.sun.proxy.$Proxy23.getMovies(Unknown Source)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.tomitribe.inget.movie.rest.cmd.MoviesGetMoviesCmd.run(MoviesGetMoviesCmd.java:15)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.tomitribe.inget.movie.rest.cmd.base.DefaultCommand.run(DefaultCommand.java:33)
> > > > > > at
> > > > org.tomitribe.inget.movie.rest.cmd.base.MainCli.main(MainCli.java:28)
> > > > > > Caused by: java.net.ConnectException: ConnectException invoking
> > > > > >
> http://localhost:8080/2695af99-a59e-4095-9f0c-0b01f122f0e4/movies:
> > > > > > Connection refused (Connection refused)
> > > > > > 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:1402)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1386)
> > > > > > at
> > > > > > org.apache.cxf.io
> > > > > >
> > > .AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77)
> > > > > > at
> > > > >
> > org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> > > > > > at
> > > > org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:673)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63)
> > > > > > ... 8 more
> > > > > > Caused by: java.net.ConnectException: Connection refused
> > (Connection
> > > > > > refused)
> > > > > > at java.net.PlainSocketImpl.socketConnect(Native Method)
> > > > > > 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.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:463)
> > > > > > at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
> > > > > > at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
> > > > > > at sun.net.www.http.HttpClient.New(HttpClient.java:339)
> > > > > > at sun.net.www.http.HttpClient.New(HttpClient.java:357)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1199)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
> > > > > > 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:1599)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1627)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1572)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1373)
> > > > > > ... 12 more
> > > > > >
> > > > >
> > > >
> > >
> >
>