While i am trying to convert java object to json object by using jersey.i am having an exception.
Java code :-(POJO)
package org.jersey.media.type;
Yeah so the Jersey distribution doesn't come with any JSON/POJO support. You need to find them yourself and add them to your project.
If you want to use the JacksonFeature, then you need to grab all the jars for it. You can specify any class you want in the provider classes param, but if you don't actually have it, nothing will happen. You are not even told by any exceptions.
These are all the jars you need
Note that these are all the jars that are used for Jersey 2.17. If you are using a newer version, then you should go here, and select the version of Jersey you are using. You can download it. Then search for the entity-filtering jar with the same version.
All the other Jackson jars are of the same version, but you should see which version of Jackson the jersey-media-json-jackson uses. When you click the Jersey version, you should be able to scroll down to see which Jackson version it uses. Then just start searching for all the above Jackson jars for that version.
For instance, if you select the latest Jersey 2.21 version of the jersey-media-json-jackson, you can scroll down and see that it uses Jackson 2.5.4. So you should search for all the above Jackson jars in 2.5.4 instead of the 2.3.2 as shown above.
Note for Maven users, all you need is
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey2.version}</version>
</dependency>
This dependency will pull in all the jars you see listed above.