I'm trying to send json from POSTMAN to RESTful webservice. I had followed this tutorial url for sending json through POSTMAN.
My URL :
http://localhost:8080/myWebService/rest/dataInsert/insert
My Service method:
@POST
@Path("/insert")
@Consumes(MediaType.APPLICATION_JSON)
public String insertData(JSONObject jsonlist) throws UnknownHostException;
My Impl:
@Override
public String insertData(JSONObject jsonlist) throws UnknownHostException {
System.out.println(jsonlist);
insertDataDao.insertData(jsonlist);
return "SUCCESS";
}
My DAO:
public String insertData(JSONObject jsonlist) throws UnknownHostException{
System.out.println(jsonlist);
MongoConnection mongoconnection = new MongoConnection();
MongoClient mongoclient = mongoconnection.getMongoClient();
MongoDatabase db = mongoclient.getDatabase("mydb");
MongoCollection<Document> col = db.getCollection("col");
String jsonString = jsonlist.toString();
System.out.println(jsonString);
Document doc = Document.parse(jsonString);
col.insertOne(doc);
System.out.println("Inserted Successfully !!!");
return "SUCCESS";
}
But I'm facing the below Exception:
JBWEB000236: Servlet.service() for servlet CXFServlet threw exception: java.lang.NoSuchMethodError: javax.ws.rs.InternalServerErrorException.validate(Ljavax/ws/rs/core/Response;Ljavax/ws/rs/core/Response$Status;)Ljavax/ws/rs/core/Response;
I'm unable to fix this issue. Can anyone please help me out regarding this ...