0 Replies Latest reply on Mar 4, 2014 9:14 PM by Caleb Cushing

    How can get Wildfly to use a newer version of Jackson, with additional datatypes?

    Caleb Cushing Newbie

      I asked this on stackoverflow, and I found this wiki, but so far haven't had any luck.


      Here's the error I get: 03:33:14,938 WARN  [org.jboss.resteasy.core.ExceptionHandler] (default task-1) Failed executing PUT /individual/5a247ce9-0a73-4373-89ce-e4177f911259/activities/432e6e5b-4185-462f-b57e-9ec04bec3d58: org.jboss.resteasy.spi.ReaderException: org.codehaus.jackson.map.JsonMappingException: Can not instantiate value of type [simple type, class java.time.Instant] from JSON String; no single-String constructor/factory method (through reference chain: com.lm.activity.DTOActivity["created"])


      It's because Wildfly doesn't know how to handle an instant. By reading the error I could simply handle it in that class, but that seems silly. I'm using the following library and am shipping it and all of an updated jackson in my `war` file, but that alone isn't doing it.

          package com.lm.infrastructure;
          import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
          import com.fasterxml.jackson.databind.ObjectMapper;
          import javax.ws.rs.Produces;
          import javax.ws.rs.core.MediaType;
          import javax.ws.rs.ext.ContextResolver;
          import javax.ws.rs.ext.Provider;
          @Produces( MediaType.APPLICATION_JSON )
          public class JacksonProducer implements ContextResolver {
              public JacksonProducer() throws Exception {
                  this.json = new ObjectMapper()
                          .configure( FAIL_ON_UNKNOWN_PROPERTIES, false );
              public ObjectMapper getContext( Class type ) {
                  return json;
              private final ObjectMapper json;

      I put this in my `web.xml` (not to be confused with `jboss-web.xml`)

      this is from a dump of the `WebArchive`