title: Can not construct instance of java.util.Date from String value - not a valid representation
body: <p>Sorry for what it seems to be a redundant question but i do have many options, 
  and despite my effort reading dozen of threads, i'm not able to understand what to do.</p>
  
  <p>I do have a java application which job is to :</p>
  
  <ol>
  <li>get datas from a SOAP WS (XML), </li>
  <li>do some logic ( incoming deliverydate will become datebl )</li>
  <li>Finally send it to a REST WS (JSON Format), which will update an Oracle Table</li>
  </ol>
  
  <p>Plan is thus as follows :<br>
      <strong>SOAP WS</strong> ---- deliverydate ----> <strong>JAVA APP</strong> (logic)  ---- datebl ----> <strong>REST WS</strong></p>
  
  <p>Jar used in JAVA APP are <code>jackson-core-asl-1.9.13.jar</code> and <code>jackson-mapper-asl-1.9.13.jar</code> among others.</p>
  
  <p>Issues i have is when dealing with dates.</p>
  
  <p>Readings :
  ( Tried to be inspired but jackson version seems not to be the same ) :</p>
  
  <p><a href="https://stackoverflow.com/questions/17655532/json-serializing-date-in-a-custom-format-can-not-construct-instance-of-java-uti">JSON Serializing date in a custom format (Can not construct instance of java.util.Date from String value)</a></p>
  
  <p><a href="https://stackoverflow.com/questions/25793322/jackson-2-3-2-issue-with-deserializing-a-date-despite-of-setting-the-date-forma">Jackson 2.3.2: Issue with deserializing a Date despite of setting the date format to ObjectMapper</a></p>
  
  <p>Edit 01/04/15</p>
  
  <p><a href="http://jackson-users.ning.com/forum/topics/cannot-deserialize-a-date" rel="noreferrer">http://jackson-users.ning.com/forum/topics/cannot-deserialize-a-date</a></p>
  
  <p><strong>The facts now</strong> </p>
  
  <p><strong>Point 1 :</strong> 
  When recovering data from SOAP WS, deliverydate is a String which exact value is  :  </p>
  
  <blockquote>
    <p>2014-07-31 07:00:00.0</p>
  </blockquote>
  
  <p><strong>Point 2:</strong>
  Just before using the setter, i thought it could be a good idea to format this String to a date.</p>
  
  <pre><code>SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                                      Date dateebl = dateFormat.parse(deliverydate);
                                      msi.setDatebl(dateebl);
  </code></pre>
  
  <p>datebl declaration in POJO </p>
  
  <pre><code>private java.util.Date    datebl;
  </code></pre>
  
  <p>At this stage, datebl value has transformed to </p>
  
  <blockquote>
    <p>Thu Jul 31 07:00:00 CEST 2014</p>
  </blockquote>
  
  <p>(despite choosing the specific format yyyy-MM-dd HH:mm:ss)</p>
  
  <p><strong>Point 3 and ERROR i have :</strong>
  The error i have is thrown by the rest server:</p>
  
  <blockquote>
    <p>Can not construct instance of java.util.Date from String value 'Thu
    Jul 31 07:00:00 CEST 2014': not a valid representation (error: Can not
    parse date "Thu Jul 31 07:00:00 CEST 2014": not compatible with any of
    standard forms ("yyyy-MM-dd'T'HH:mm:ss.SSSZ",
    "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "EEE, dd MMM yyyy HH:mm:ss zzz",
    "yyyy-MM-dd"))  at [Source:
    org.glassfish.jersey.message.internal.EntityInputStream@5709779; line:
    1, column: 74] (through reference chain:
    com.rest.entities.MvtSwapsIn["datebl"])</p>
  </blockquote>
  
  <p><strong>What i tried to do :</strong>
   To resolve this, as i'm using a version prior to 2.x,  i thought that my best option was to use a custom serializer, so :</p>
  
  <ul>
  <li><p>In pojo, annotation was added just before the getter</p>
  
  <pre><code>@JsonSerialize(using = CustomJsonDateSerializer.class)
      public java.util.Date getDatebl() {
          return datebl;
      }
  </code></pre></li>
  <li><p>Serializer was created as follows</p>
  
  <pre><code>public class CustomJsonDateSerializer extends JsonSerializer&lt;Date&gt; {
  
  @Override
  public void serialize(Date value, JsonGenerator jgen,
          SerializerProvider provider) throws IOException,
          JsonProcessingException {
      SimpleDateFormat dateFormat = new SimpleDateFormat(Properties.General.FORMAT_HEURE_JSON_SERIALIZE_2);
      String dateString = dateFormat.format(value);
      jgen.writeString(dateString);       
  }
  </code></pre>
  
  <p>}</p></li>
  </ul>
  
  <p>In example,tried with FORMAT_HEURE_JSON_SERIALIZE_2, but tried many others without success.</p>
  
  <pre><code>public static final String  FORMAT_HEURE_JSON               = new String("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
  public static final String  FORMAT_HEURE_JSON_SERIALIZE     = new String("EEE yyyy-MM-dd'T'HH:mm:ss.SSSZ");
  public static final String  FORMAT_HEURE_JSON_SERIALIZE_2   = new String("EEE, dd MMM yyyy HH:mm:ss zzz");
  public static final String  FORMAT_HEURE_JSON_SERIALIZE_3   = new String("yyyy-MM-dd HH:mm:ss");
  </code></pre>
  
  <p>At this point, i'm lost. </p>
  
  <p>I don't know where and how to update my code. </p>
  
  <ol>
  <li>Should i still use SimpleDateFormat after getting date from SOAP ws ?</li>
  <li>Given the fact i'm using jackson 1.9, is my @JsonSerialize annotation good ? ( as well as the serializer ?)</li>
  <li>Do i have to modify something on the rest server ?</li>
  </ol>
  
  <p>Please can someone help me organize my thoughts ?</p>
  
  <p>Kind regards,</p>
  
  <p>Pierre</p>