Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9176001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:00:40+00:00 2026-06-17T17:00:40+00:00

I am developing a Client-Server app with JAX-RS / Apache CXF , JSON I

  • 0

I am developing a Client-Server app with JAX-RS / Apache CXF, JSON

I would like Apache CXF 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.

I have seen several confusing posts/answers on this subject and came up with using the @WebFault annotation :

@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;
   }
}

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.

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 ?).

I would appreciate if you could point me at some working example.
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:00:41+00:00Added an answer on June 17, 2026 at 5:00 pm

    @WebFault's are not part of the JAX-RS specification. You will want to read up on section 3.3.4 of the specification, which describes the different ways you can accomplish what you are trying to do.

    Option 1

    Design your resource classes to throw WebApplicationException’s. Set the response property of these exceptions to be a valid JAX-RS response containing the fault beans you want to send to the client.

    Option 2

    Define exception mapping providers. You can create a hierarchy of these to handle all the common exceptions your application will throw. Or you can create a top level exception with an embedded bean and an exception handler for it. And then derive several specific exceptions from the top level one.

    public abstract class MyApplicationException<T> extends Exception {
        private T faultBean;
    
        // Constructors, setters/getters
    }
    
    @Provider
    public class MyApplicationExceptionHandler implements ExceptionMapper<MyApplicationException<?>> {
        // Implementation
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a new client-server app (.Net) and have up until now been using
I am developing a system which include a server app & a client app,
Iam developing a client/server app in java. I need to store ids , passwords
I'm developing an web app with jsp,servlet in server side and javascript in client
I'm developing a client-server app to distribute and execute code in multiple clients. This
I'm developing a client-server app using WCF over the netTcpBinding. My solution has 2
I am developing a client server app that uses ssl (openssl) to establish a
While Developing a Java EE Web app, I would like to know simple ways
I'm developing a client/server app in which the client calls the WCF service every
I am about to start designing/developing a client-server iOS app. I am leaning towards

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.