java - Error when trying to retrieve data from mongodb on rest api -


public class record {   private datetime timestamp; private string filename; private string cameraid;   public record(string timestamp, string filename, string cameraid) {     this.timestamp = isodatetimeformat.datetime().parsedatetime(timestamp);     this.filename = filename;     this.cameraid = cameraid;  } //getters & setters  (model) -----------------------------------------------------------------------------  public class recordcontroller { @autowired private recordrepository rep;  @requestmapping(value="store") public  string  camera (@requestparam(required=true, value="ts") string timestamp, @requestparam(value="fn",required=true) string filename, @requestparam(value="cam",required=true) string cameraid)  {     try {         record cam = new record(timestamp,filename,cameraid);          rep.save(cam);         return "ok";     }catch(exception ex){          string errormessage;         errormessage = ex + " <== error";         return ("error: " + ex.getmessage());}  } @requestmapping(value="li", method=requestmethod.get) public @responsebody list<record> getall() {     return rep.findall(); } } (controller)  ---------------------------------------------------------------------------- import org.springframework.data.mongodb.repository.mongorepository;  public interface recordrepository extends mongorepository<record, string> { } (recpository) 

the error got is:

failed instantiate hello.record using constructor public hello.record(java.lang.string,java.lang.string,java.lang.string) arguments 2016-06-06t00:19:09.223+08:00,9d9fd7f8f4caec99bce9dff8f4644e41,000000006f4280af 

add default constructor

public class record {   private datetime timestamp; private string filename; private string cameraid;  public record(){} //default constructor  public record(string timestamp, string filename, string cameraid) {     this.timestamp = isodatetimeformat.datetime().parsedatetime(timestamp);     this.filename = filename;     this.cameraid = cameraid;  }  //getter , setter }