I have looked at all the answers available on this topic, either I am facing a completely different problem or I am missing something big time.
Service Class:
package org.test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
//http://localhost:8080/JunkWeb/rest/TestRestService/callService
@Path("/TestRestService")
public class TestRestService {
@GET
@Path("/callService")
@Produces(MediaType.TEXT_PLAIN)
public String callService(){return "from Rest Service";}
}//class closing
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>JunkWeb</display-name>
<servlet>
<servlet-name>jersey-serlvet</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>org.test</param-value>
</init-param>
<!-- <init-param>
<param-name>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>jersey-serlvet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
The URL:
http://localhost:8080/JunkWeb/rest/TestRestService/callService
Should work but it does not. Any help will be really appreciated.
I am using Jersey 2.17 and Tomcat 8.0.20