Issues with JSON processing using JAXBElement under Jersey 2.2 with MOXy-Collection of common programming errors

I extended the jersey-examples-moxy code to use an XML schema definition instead of the JAXB annotated beans. The xjc compiled XML schema produces XML and JSON encodings identical to the original example.

I followed the jersey instructions and used the ObjectFactory to generate the JAXBElement Customer object representation within CustomerResource.java. I also modified the client as described. I also incorporated the fix described in PUT issues with JSON processing using JAXB under Jersey 2.2 with MOXy

The MediaType.APPLICATION_XML functions perfectly, and MediaType.APPLICATION_JSON works for GETs, but the client is failing to marshall JSON on a PUT with “MessageBodyWriter not found”. The following exception is thrown:

testJsonCustomer(org.glassfish.jersey.examples.jaxbmoxy.MoxyAppTest)  Time elapsed: 0.113 sec