java - Getting Error using Jersey client -


this question has answer here:

i using jersey client push data localhost. here 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 execute in eclipse works fine , db on localhost inserted recoord using savedata.php. make runnable jar of project , run jar throws error -

 message body writer java type, class org.codehaus.jettison.json.jsonobject, , mime media type, application/json not found 

how can make work when executing runnable jar?

you have have jersey client .jar on classpath of exectuable .jar jersey .jar.

if using maven , should using maven build artifacts, can use shade plugin , create uberjar of code, , dependencies of code in single executable .jar file. won't need worry specifying dependences , transitive dependencies on command line.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

node.js - Node - Passport Auth - Authed Post Route hangs on form submission -

Does Firefox offer AppleScript support to get URL of windows? -