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.

Comments

Popular posts from this blog

Profiling Java @ 2019

Shared/Pro/Managed Hosting for your site - which to choose ? (NO AFFILIATE LINKS!)

ZVR converter