0 Replies Latest reply on Nov 24, 2017 7:48 AM by Jochen Zink

    Wildfly 11 ignores custom JaxBProvider for Unmarshalling

    Jochen Zink Newbie



      we want to deploy a JAX-RS rest service on Wildfly 11. To turn on schema validation, we use a ContextResolver to deliver a custom JAX-B Context object. We figured out, that the provider is only called in case of marshalling, but nof of unmarshalling. Is this a Bug or have a usage error?


      Here the custom provider


      @Produces({MediaType.APPLICATION_XML, MediaType.TEXT_XML})

      @Consumes({MediaType.APPLICATION_XML, MediaType.TEXT_XML})

      public class JaxbProvider implements ContextResolver<JAXBContext> {

         public JAXBContext getContext(Class<?> type) {

             // this method is only called in marshalling case, not for incoming requests!

           JAXBContext ctx = // ... create context with schema validation enabled

           return ctx;





      In our Application class, the Provider is added as singleton:



      public class RestApplication extends Application {


          public Set<Object> getSingletons() {

              Set<Object> singletons = new HashSet<>();

              singletons.add(new JaxbProvider());

             return singletons;





      Thanks for the help