-2

I'm implementing a REST API with Jersey Controllers.

On some cases I want to return error status codes like 400, 501, etc. that are being generated by a sentence like:

throw new WebApplicationException("Error", 501);

When I deploy the app in local, everything works ok. However, when I deploy it in a Docker image, for any error that the controller throws, the client gets a 404 status code.

I included traces just before throwing the Exceptions to be sure that the code was executed. And it is.

Seems as if at some code layer, different from the application, the status codes were being converted from 400 or 501 or 502 to 404, and that is what the client is getting.

Any clues?

Andres
  • 10,561
  • 4
  • 45
  • 63

1 Answers1

0

The errors were being mapped in the web.xml file at the Docker's Tomcat. Therefore, the app deployed there inherited those mappings.

Andres
  • 10,561
  • 4
  • 45
  • 63