Markus Jung created TOMEE-4728:
----------------------------------

             Summary: MicroProfile Health endpoint runs the providers of a 
declared JAX-RS application
                 Key: TOMEE-4728
                 URL: https://issues.apache.org/jira/browse/TOMEE-4728
             Project: TomEE
          Issue Type: Bug
            Reporter: Markus Jung


Since TOMEE-4716, {{RESTService}} deploys the MicroProfile Health endpoint 
({{MicroProfileHealthChecksEndpoint}}) in its own {{InternalApplication}} at 
the context root when the webapp declares JAX-RS applications, but none at the 
context root.

That application is deployed with {{additionalProviders}}, the collection that 
the loop over the declared applications fills with the providers each one lists 
in {{getClasses()}} / {{getSingletons()}}. So a provider meant for one 
application, e.g. an unbound {{@PreMatching}} {{ContainerRequestFilter}} of an 
application at {{/api}}, also runs for {{/health}}, {{/health/live}}, 
{{/health/ready}} and {{/health/started}}.

With a filter that aborts every request it doesn't recognize, all health 
endpoints answer with that filter's response instead of the health checks. Seen 
with an MCP server application whose pre-matching filter answers {{503}} with 
an empty body outside its own application: every {{/health}} request returns 
{{503}}, and the endpoint method never runs.

Fix: deploy the container application with only the webapp-wide providers, 
those collected before the declared applications add their own.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to