title: Registering JacksonJsonProvider with ObjectMapper + JavaTimeModule to Jersey 2 Client
body: <p>I'm trying to marshal response containing ISO formatted timestamp like that:</p>
  
  <pre><code>{
  ...
      "time" : "2014-07-02T04:00:00.000000Z"
  ...
  }
  </code></pre>
  
  <p>into <code>ZonedDateTime</code> field in my domain model object. Eventually it works if I use solution that is commented in following snippet.There are many similar questions on SO but I would like to get a specific answer
   what is wrong with  another approach which uses <code>JacksonJsonProvider</code> with <code>ObjectMapper + JavaTimeModule</code>?</p>
  
  <pre><code>        ObjectMapper mapper = new ObjectMapper();
          mapper.registerModule(new JavaTimeModule());
          JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
          Client client = ClientBuilder.newBuilder()
  //                .register(new ObjectMapperContextResolver(){
  //                    @Override
  //                    public ObjectMapper getContext(Class&lt;?&gt; type) {
  //                        ObjectMapper mapper = new ObjectMapper();
  //                        mapper.registerModule(new JavaTimeModule());
  //                        return mapper;
  //                    }
  //                })
                  .register(provider)
                  .register(JacksonFeature.class)
                  .build();
  </code></pre>
  
  <p>Error I get:</p>
  
  <pre><code>javax.ws.rs.client.ResponseProcessingException: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of java.time.ZonedDateTime: no String-argument constructor/factory method to deserialize from String value ('2017-02-24T20:46:05.000000Z')
   at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@53941c2f
  </code></pre>
  
  <p>Project dependencies are:</p>
  
  <pre><code>compile 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.8.7'
  compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.7'
  compile 'com.fasterxml.jackson.core:jackson-core:2.8.7'
  compile 'com.fasterxml.jackson.core:jackson-databind:2.8.7'
  compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.7'
  compile 'org.glassfish.jersey.core:jersey-client:2.25.1'
  </code></pre>
  
  <p><em>edit</em></p>
  
  <p>Deserialization happens in here:</p>
  
  <pre><code>CandlesResponse&lt;BidAskCandle&gt; candlesResponse = webTarget.request()
                  .header(HttpHeaders.AUTHORIZATION,"Bearer "+token)
                  .accept(MediaType.APPLICATION_JSON)
                  .get(new GenericType&lt;CandlesResponse&lt;BidAskCandle&gt;&gt;(){});
  </code></pre>