Marshaling / Demarshaling JSON with Java EE 7 / Glassfish 4.1 results in null object Marshaling / Demarshaling JSON with Java EE 7 / Glassfish 4.1 results in null object json json

Marshaling / Demarshaling JSON with Java EE 7 / Glassfish 4.1 results in null object


You should be able to solve this by disabling MOXy (register the class below in getClasses()) and get rid of your set.add(new JacksonJsonProvider()); singleton. I use this for all my GF4 projects to force Jersey to use Jackson.

/** * Feature to disable Moxy and Enable Jackson processing */private static class Jackson2Feature implements Feature {    @Override    public boolean configure(FeatureContext context) {        final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(                CommonProperties.MOXY_JSON_FEATURE_DISABLE,                context.getConfiguration().getRuntimeType());        context.property(disableMoxy, true);        // add the default Jackson exception mappers and allow jaxb annotations        context.register(JsonParseExceptionMapper.class);        context.register(JacksonJaxbJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);        return true;    }}