Exception while posting date to RESTful services when used xmlAdapter
<p>I have written RESTful services which accepts and responds in json format. </p>

<p>I have written an xmlAdapter class when ii got an exception while passing date to the service saying "date dosent have a zero argument constructor".</p>

<p>The adapter class looks like this.</p>

<pre><code>public class SqlDateAdapter extends XmlAdapter&lt;String, Date&gt; {
public String marshal(java.sql.Date d) {
    return d.toString();
}

public Date unmarshal(String v) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd"); // QueryConstants.DATE_FORMATE
    java.sql.Date sqlDate = null;
    try {
        java.util.Date convertedDate = dateFormat.parse(v);
        sqlDate = new java.sql.Date(convertedDate.getTime());
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return sqlDate;
}
</code></pre>

<p>}</p>

<p>Now when I post data to the service, I get the following exception.</p>

<p>"Class java.util.Date can not be instantiated using a constructor with a single String argument"  </p>

<p>Can anyone help me with this.</p>

<p>Thanks in advance.</p>
