title: Deserialization issue from XML to POJO with Jackson: no String-argument constructor/factory method to deserialize from String value
body: <p>I've got an XML document which I need to convert (deserialize) into Java POJO. I <strong>cannot change the structure</strong> of the XML document.
  I use Java 8, and Jackson framework for mapping.
  <strong>Gradle</strong> dependencies:</p>
  
  <pre><code>dependencies {
      compile('com.fasterxml.jackson.dataformat:jackson-dataformat-xml')
      compile('org.springframework.boot:spring-boot-starter-freemarker')
      compile('org.springframework.boot:spring-boot-starter-web')
      providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
      testCompile('org.springframework.boot:spring-boot-starter-test')
  }
  </code></pre>
  
  <p>Wrapper XML Doc:</p>
  
  <pre><code>@JacksonXmlRootElement(localName = "rates_response")
  public class RatesResponse implements Serializable{
      private static final long serialVersionUID = 3254688495454519L;
  
      @JacksonXmlProperty(isAttribute = true)
      private String b_number = "";
  
      @JacksonXmlProperty(isAttribute = true)
      private String l_premium = "";
  
      @JacksonXmlProperty(isAttribute = true)
      private String currency = "";
  
      @XmlElement(required = false)
      @JacksonXmlProperty
      private String c_b_relationship = null;
  
      @JacksonXmlProperty(isAttribute = true)
      private String n_of_p_loans = null;
  
      /*
       * Key: status_code
       * Key: status_explanation
       */
      @JacksonXmlElementWrapper
      private Map&lt;String, String&gt; message_status = null;
  
     // @XmlElement
      @JacksonXmlElementWrapper(useWrapping = false)
      private List&lt;RateDetails&gt; rate_details = null;
  
      public RatesResponse(){}
       //GETTERS/SETTERS
  Child document (`List&lt;RateDetails&gt; rate_details = null;`):
  
  
  @JacksonXmlRootElement(localName = "rate_details")
  public class RateDetails implements Serializable {
      private static final long serialVersionUID = 324564684815158619L;
  
      @JacksonXmlProperty
      private String r_reference = null;
      @JacksonXmlProperty
      private String n_of_p_days = null;
      @JacksonXmlProperty
      private String n_of_instalments = null;
      @JacksonXmlProperty
      private String n_rate = null;
      @JacksonXmlProperty
      private String p_p_available = null;
  
      @XmlElement(required = false)
      @JacksonXmlProperty
      private String i_overrider = null;//not always appears in doc
      @JacksonXmlProperty
      private String a_fee = null;
      @JacksonXmlProperty
      private String m_fee = null;
      @JacksonXmlProperty
      private String t_fees = null;
      @JacksonXmlProperty
      private String t_c_for_credit = null;
      @JacksonXmlProperty
      private String d_amount = null;
      @JacksonXmlProperty
      private String apr = null;
  
      public RateDetails(){}
      //GETTERS/SETTERS
  </code></pre>
  
  <p>XML document to parse:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!DOCTYPE rates_response SYSTEM "p_f_interface.dtd"&gt;
  &lt;rates_response b_number="KK5000000000" l_premium="5000.00" currency="GBP" &gt;
      &lt;message_status&gt;
          &lt;status_code&gt;1000&lt;/status_code&gt;
          &lt;status_explanation&gt;Success&lt;/status_explanation&gt;
      &lt;/message_status&gt;
      &lt;c_b_relationship n_of_p_loans="0"/&gt;
      &lt;rate_details&gt;
          &lt;r_reference&gt;AS28&lt;/r_reference&gt;
          &lt;n_of_p_days&gt;28&lt;/n_of_p_days&gt;
          &lt;n_of_instalments&gt;12&lt;/n_of_instalments&gt;
          &lt;n_rate&gt;7.00&lt;/n_rate&gt;
          &lt;p_p_available&gt;NO&lt;/p_p_available&gt;
          &lt;i_overrider&gt;3.65&lt;/i_overrider&gt;
          &lt;a_fee&gt;0.00&lt;/a_fee&gt;
          &lt;m_fee&gt;0.00&lt;/m_fee&gt;
          &lt;t_fees&gt;0.00&lt;/t_fees&gt;
          &lt;t_c_for_credit&gt;350.00&lt;/t_c_for_credit&gt;
          &lt;d_amount&gt;0.00&lt;/d_amount&gt;
          &lt;apr&gt;16.05&lt;/apr&gt;
      &lt;/rate_details&gt;    
  &lt;/rates_response&gt;
  </code></pre>
  
  <p>The method which parses the doc:</p>
  
  <pre><code>private RatesResponse readRatesDoc() {
      RatesResponse xmlContainer = null;
  
      ObjectMapper xmlMapper = new XmlMapper();
      try {
          xmlContainer = xmlMapper.readValue(contrUtil.readXmlFile("Rates_Response.xml"), RatesResponse.class);
      } catch (IOException e) {
          log.log(Level.SEVERE, "An Exception on parsing XML document", e);
      }
      return xmlContainer;
  }
  </code></pre>
  
  <p>The exception:</p>
  
  <pre><code>com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of premium.finance.beanResponse.rates.RateDetails: no String-argument constructor/factory method to deserialize from String value ('16.05')
   at [Source: java.io.StringReader@7bd22d0b; line: 1, column: 945] (through reference chain: premium.finance.beanResponse.rates.RatesResponse["rate_details"]-&gt;java.util.ArrayList[1])
      at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:261) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1456) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1012) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.deser.ValueInstantiator._createFromStringFallbacks(ValueInstantiator.java:366) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromString(StdValueInstantiator.java:307) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromString(BeanDeserializerBase.java:1278) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:159) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:150) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:277) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:249) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:26) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:499) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:101) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:276) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:120) ~[jackson-dataformat-xml-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3789) ~[jackson-databind-2.8.3.jar:2.8.3]
      at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2833) ~[jackson-databind-2.8.3.jar:2.8.3]
      at premium.finance.controller.IndexController.readRatesDoc(IndexController.java:190) [main/:na]
      at premium.finance.controller.IndexController.requestIndex(IndexController.java:69) [main/:na]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_91]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_91]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_91]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_91]
      at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_91]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_91]
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
  </code></pre>
  
  <p>The top line says:</p>
  
  <pre><code>no String-argument constructor/factory method to deserialize from String value ('16.05')
  </code></pre>
  
  <p>The value it is referring to comes from under this tag:</p>
  
  <pre><code>&lt;apr&gt;16.05&lt;/apr&gt;
  </code></pre>
  
  <p>If I displace (move around) the tag, <code>&lt;apr&gt;16.05&lt;/apr&gt;</code>, the parser works and no exception gets caused. If I replace the tag by different tag, the same exception still occurs; <strong>it affects only the last tag within the <code>&lt;rate_details&gt;</code> wrapper tag</strong>, for some reasons.</p>
  
  <p>What the problem can be?</p>