2 Replies Latest reply on Mar 11, 2013 4:12 AM by Freeman(Yue) Fang

    Catching org.apache.cxf.interceptor.Fault: Connection refused

    Jean-Marc Reymond Newbie




      I am having trouble catching the following exception when calling a web service via CXF:

      org.apache.cxf.interceptor.Fault: Connection refused


      Here is what I do:

      I have my route and from there I call a processor which itself does the CXF call.


      Here is the route:








      And here is my clientProcessor:


      // Creating the JaxWS client dynamically

      JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();



      for (BackendService bsi : bsis) {

          wsUrl = bsi.getUrl();


          WSDL hcWSDL = (WSDL) factory.create();



          try {

              hcResponse = hcWSDL.healthCheck(hcRequest);


              handleHCResponse(hcResponse, bsi.getId());


          } catch (WebServiceException wse) {


          } catch (Exception ex) {






      My problem is that when the backend server exposing the web service is down, I get the following exception from the "hcWSDL.healthCheck(hcRequest);" statement:

      org.apache.cxf.interceptor.Fault: Connection refused

      In itself it is not a problem. The problem is that my try/catch does not catch it.

      It gets caught in the pollingExceptionsProcessor in the onException mechanism at the route level!

      And I need to catch it in my try/catch so I can handle it properly and carry on with my loop.


      The interesting thing is that if I replace "hcWSDL.healthCheck(hcRequest);" with creating and throwing my own Fault exception then it gets properly caught! Like this:

      Throwable t = new Throwable("I created my own Fault Exception");

      throw new Fault(t);



      So can someone tell me the following:

      - how can the exception from the WS call  escape the try/catch without being caught?

      - does it have anything to do with some inbuilt CXF interceptors?

      - how can I solve my problem so I can catch the Fault exception in my clientProcessor and prevent it from ending up being caught at the route level?



      Thanks a lot!