I am trying to write a Jersey service (and test client) that consumes
the same bean hierarchy as json or xml (users choice). I did json
first using Jackson annotations, and it worked perfectly. I did XML
next using JAXB annotations added onto the Jackson ones in the beans,
again, worked perfectly.
However, when both annotations exist, the JSON stuff fails. The
request launches, but I get UnrecognizedPropertyException on the
server. The message is "Unrecognized field <fieldName> (Class
<myClass>), not marked as ignorable." The field it blows up on is an
array of sub-beans, which again, works FINE when I run with Jackson
annotations alone.
Why does the presence of JAXB annotations throw everything wonky? And
how can I make them coexist peacefully?
Also, I am very dissatisfied with the error that get generated. A
user of this service gets back a very generic 500 error. They are not
even told that it is a parsing problem, much less given any clues as
to the nature of the problem. I see no opportunity for me to hook in
and improve the error response. Is there one I am missing?
Brian Mulholland
"For every complex problem, there is an answer that is clear, simple and wrong."
--H.L. Mencken
"Politics is the art of looking for trouble, finding it everywhere,
diagnosing it incorrectly, and applying the wrong remedies."
--Groucho Marx