I've tried multiple reinstallations of tomcat and followed this tutorial: https://www.youtube.com/watch?v=5jQSat1cKMo
However I always get this error:
The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
Screenshot here:
This is my current Hello.java class:
package test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/hello")
public class Hello {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String sayHello() {
String resource="This is some test return text";
return resource;
}
}
Current web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>JavaAPI</display-name>
<servlet>
<servlet-name>JavaAPI</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer.class</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>test</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JavaAPI</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
I have tried with and without the extra imports of:
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
What am I missing?
UPDATE:
I'm using plain using IDE
I am also using Jersey JAX-RS 2.1