I am new to using JAX-RS and wrote a sample application that outputs a json object. but I am getting an exception. Here is my code:
@Path(\"/hello\")
public
Working with Jersey 1.8, I was getting the same error while creating a JSON object and hitting a REST API from client side.
If you are facing issue at server side then, make sure that you have correctly included jersey-json.jar in classpath and mapped correct init-param in web.xml as mentioned in other answers.
As per Jersey 1.8 documentation, the following snippet shows how to use the POJO JSON mapping feature on the client side:
ClientConfig clientConfig = new DefaultClientConfig();
clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING,Boolean.TRUE);
Client client = Client.create(clientConfig);