I am using a jersey client to push data to the localhost. Here is my code -
public CloudConnection(JSONObject jsonPush) throws ClientProtocolException, IOException, JSONException {
ClientConfig config = new DefaultClientConfig();
Client client = Client.create(config);
WebResource webResource = client.resource(UriBuilder.fromUri("http://localhost/visual/savedata.php").build());
ClientResponse response = webResource.path("restPath").path("resourcePath").type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, jsonPush);
}
When i execute this in Eclipse it works fine and the db on my localhost is inserted with a recoord using savedata.php. But as soon i make a runnable jar of my project and run the jar it throws error -
a message body writer for java type, class org.codehaus.jettison.json.JSONObject, and MIME media type, application/json was not found
How can i make this work normally when executing from the runnable jar?