What does: "Fault occurred while processing" in the client mean? and how do you reveal the real exception?

I have this CXF client which sometimes throws normal exceptions but some of the other times it throws me a "Fault occurred while processing", well, what does that mean?

When you get back a "Fault occurred while processing" it means that a web service threw an unchecked exception.  The CXF framework catches it and puts together a fault message which it sends back to the client.  The client’s stack trace at that point is pretty-much irrelevant.

There may be a way to get CXF to log the server stack trace, but I haven’t found it yet (feel free to comment on the post if you found one).  There may also be a way to stick a handler into the flow to get the exception before constructing the fault message, but I haven’t found that yet either (ditto).

If a checked-exception is thrown, then the exception – or at least its message – gets sent back to the client where it’s reconstructed and rethrown to be caught by the client.

Debugging a problem like this, once you can recreate it at will, is simple, as long as you can run the web service in a debugger, so that you can step through the web service and find where the unchecked exception (usually a NullPointerException) is thrown.  Alternatively, you can temporarily surround the code inside the WS with a try/catch and then print the stack when you catch the exception.

EDIT (2016)
As of this year (2016) I am actively earning 3000$/month from blogging (not this blog, this is for my fun), I have blogged here a big article about my mistakes and my success in getting to that goal (I intend to leave my working job till the end of 2016, living off my blogging), if my success inspires you then please leave me a comment there:


Popular posts from this blog

Start Working with AutoIT

How to read Android apk contents

SCummVM for Android