I have made a rest service, and now I am trying to call the same from the client end. For that I have made different dynamic web project and add all jersey jars to the WEB-INF/lib folder. I am using Jearsy(jaxrs-ri-2.23.2) version.
Now when I run my application it give me the below error as the main root cause.
Servlet.service() for servlet [controller.DemoServlet] in context with path [/TestingRestClient] threw exception [Servlet execution threw an exception] with root cause java.lang.ClassNotFoundException: com.sun.jersey.core.util.FeaturesAndProperties
Also after scrolling upward the console I found below error too:
Caused by: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org/glassfish/jersey/client/ClientConfig
I have searched both the errors, for the first error I have applied changes to my web.xml file. Below are the changes:
<servlet>
<servlet-name>DemoServlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>controller</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>DemoServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
"controller" is my package where DemoServlet class is present.And I am using the same url pattern. Is the above web.xml should be used in server end only, I have used in both ends but give same result. And for the second error, I found there must be Class which compiler or server is not able to find. So I check again all jar files in my lib folder, they all present ; then I add all the jar files to class build path. But still I am getting the same error. I need help. I don't know what should I do next.