title: Mapping of custom exception in JAX-RS via @WebFault annotation
body: <p>I am developing a Client-Server app with <strong>JAX-RS</strong> / Apache <strong>CXF</strong>, <strong>JSON</strong></p>
  
  <p>I would like <strong>Apache CXF</strong> to handle my exception transparently on both ends : Which means transforming the exception into a bean, serializing it with my Jackson Serializer (JSON) and then doing the over way around on client side.</p>
  
  <p>I have seen several confusing posts/answers on this subject and came up with using the @WebFault annotation :</p>
  
  <pre><code>@WebFault(name=CODE, faultBean="foo.bar.FaultBean")
  public class DuplicateRuleNameFault extends Exception {
     static final public String CODE = "DUPLICATE_RULE_NAME";
     private FaultBean faultBean;
  
     public DuplicateRuleNameFault(String msg) {
       super(msg);
       this.faultBean = new FaultBean(msg);
     }
     public DuplicateRuleNameFault() {
     }
     public FaultBean getFaultBean() {
       return faultBean;
     }
     public void setFaultBean(FaultBean faultBean) {
       this.faultBean = faultBean;
     }
  }
  </code></pre>
  
  <p>With no success ... Currently, CXF seems to happily ignore the annotation on the Exception and handle it as an unknown exception : 500 status error and no response body generated on the server side.</p>
  
  <p>Is there something specific I have to configure in the "" server element of my Spring context ? I already have Spring scanning my Exception/FaultBean classes (is it even needed BTW ?).</p>
  
  <p>I would appreciate if you could point me at some working example.
  Thanks.</p>