I am new to web services. So I started with a small program like the following.
It's working perfectly in GlassFish server but not in Tomcat (I want to run on Tomcat). It's a simple program which gives only the idea of how to run the web service application.
FirstRestService.java:
package com.sandy.demo;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/resources")
public class FirstRestService extends Application {
}
Employees.java:
package com.sandy.demo;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@Path("/employees")
public class Employees {
@GET
public String getEmployeesNames() {
return "Hello World";
}
}
I have included the jsr311-api-1.1.1.jar
(JAX-RS API JAR file).
I took a working WAR file of the application and deployed in GlassFish Server. Then I ran the server with the URL: http://localhost:8080/MyFirstRestApplication/resources/employees
.
But I am unable to do the same in Tomcat.