0

I have a service that has two classes and is very simple:

@ApplicationPath("/api")
public class HelloApplication extends Application {}

and

@Path("/hello-world")
public class HelloResource {
@GET
//@Produces("text/plain")
public Response hello() {
    //return Response.ok().entity("This is JAX-RS").build();
    return Response.ok().status(200).build();
    //return "Hello, World!";
}
}

Commented lines are the ones that I tried to use. Every time I call "http://localhost:8080/api/hello-world" or "http://localhost:8080/api" the response is 404-Not Found. I use Tomcat 9.0.50.

What can be wrong with my usage of the classes or their calling from the outside?

coder-coder
  • 323
  • 4
  • 13

1 Answers1

0

The problem was - for some reason - in the usage of Tomcat. After moving to JBoss WildFly 24.0.0 the problem disappeared and the system started to work correctly.

If someone knows the reason of such an incompatibility - write a comment or an extra answer.

coder-coder
  • 323
  • 4
  • 13
  • 1
    Tomcat is not an EE server. There is no JAX-RS implementation. If you are only using the jax-rs api jar, then you have no implementation. Wildfly is an EE server with an implementation. https://stackoverflow.com/a/43382662/2587435 – Paul Samsotha Nov 14 '21 at 02:07