Skip to content
Advertisement

No response on a GET query to JAX-RS service

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?

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement