cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Fw: Cannot catch the CXF exception
Date Fri, 13 Jan 2012 16:46:20 GMT

That should definitely be throwing an exception.   Any chance you can create a 
small testcase?   What version of CXF?   Also, what is the "caused by" 
exception?

Dan



On Thursday, January 12, 2012 5:27:10 PM Hongyu Zhang wrote:
> Hi there,
> 
> 
> 
> I am a newbie of CXF, and I just created a client using wsdl2java. It works
> fine until I started to test its exception feature. I shortened the timeout
> properties to extremely low (1 ms) to simulate the server time out scene. I
> did succeed in getting the timeout exception, but I couldn't catch the
> exception as exemplified in the code below
> 
> // start of code
> try {
>   myClient.queryServer(); // query web service
> } catch (Exception e) {
>   System.out.println("Caught exception"); // this has never been run so far
> for some reason }
> // end of code
> 
> In real life runs, my application always skips the catch section code
> completely. It did print out exception message to the standard output,
> something like:
> 
> WARNING: Interceptor for
> {http://mytestcom.com/}MyService#{http://mytesturl.com/}MyMethod has thrown
> exception, unwinding now org.apache.cxf.interceptor.Fault: Could not send
> Message.
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInte
> rceptor.handleMessage(MessageSenderInterceptor.java:64) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.java:263) at
> org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:533) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
> at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
> at $Proxy25.MyMethod(Unknown Source)
> at com.mytestcom.service....myMethod(MyClient.java:69)
> at MyTest.main(MyTest.java:16)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
> 9) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
> l.java:25) at java.lang.reflect.Method.invoke(Method.java:597)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> 
> It seems that the CXF library stores exception in a variable and didn't
> interrupt my code, and there was no exception to be caught by my own code.
> 
> My question is whether I can change this behavior to activate a real
> exception so my client code can handle it at my own will, e.g., displaying
> an elegant message to my user saying that the web server is too slow to
> respond.
> 
> Thanks!
> 
> Hongyu
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Mime
View raw message