[ https://issues.apache.org/jira/browse/FELIX-6791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18000675#comment-18000675 ]
Carsten Ziegeler edited comment on FELIX-6791 at 7/6/25 12:06 PM: ------------------------------------------------------------------ We had a lengthy discussion about this in the OSGi spec group - the current behaviour of Pax Web is wrong, see https://github.com/osgi/osgi/pull/830#issuecomment-2903322334 And in my last sentence I warned that this behaviour will cause trouble with existing code. The solution is therefore to fix Pax Web. If there is interesting to make the servlet name of the hc servlet configurable, that's fine - but still it is not required. was (Author: cziegeler): We had a lengthy discussion about this in the OSGi spec group - the current behaviour of Pax Web is wrong, see https://github.com/osgi/osgi/pull/830#issuecomment-2903322334 > Only a single format can be allowed when using Pax Web > ------------------------------------------------------ > > Key: FELIX-6791 > URL: https://issues.apache.org/jira/browse/FELIX-6791 > Project: Felix > Issue Type: Bug > Components: Health Checks > Affects Versions: healthcheck.core 2.0.14, healthcheck.core 2.3.0 > Environment: org.apache.felix.healthcheck.core 2.0.14 > org.ops4j.pax.web.pax-web-spi 8.30.0 > Reporter: Jonathan Wright > Assignee: Paul Rütter > Priority: Minor > Attachments: org.apache.felix.healthcheck.core-2.3.1-SNAPSHOT.jar, > stacktrace.txt > > > {{HealthCheckExecutorServlet}} registers a new instance of > {{HealthCheckExecutorServlet$ProxyServlet}} for each allowed format. However, > it does not supply a unique name for each instance. This violates [Section > 102.2|https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.http.html#i1223311] > of the OSGi Http Service Specification, which includes the following > statement: > {quote}All {{Servlet}} objects and resource registrations share the same > name-space. If an attempt is made to register a resource or {{Servlet}} > object under the same name as a currently registered resource or {{Servlet}} > object, a {{NamespaceException}} is thrown. > {quote} > Pax Web enforces the above mentioned requirement (see [^stacktrace.txt]). As > a result, only one instance of {{HealthCheckExecutorServlet$ProxyServlet}} is > registered. To prevent {{Servlet}} registration errors when using Pax Web, > you have to set the {{allowed.formats}} configuration property to a single > value, e.g. {{{}allowed.formats=["json"]{}}}. > You cannot specify a name when registering a {{Servlet}} via the > {{org.osgi.service.http.HttpService}} API, so the 2.0.14 version of > {{HealthCheckExecutorServlet}} would need to be updated to use the Whiteboard > Pattern. The 2.1.0 version, which does use the Whiteboard Pattern, simply > needs to specify a unique {{osgi.http.whiteboard.servlet.name}} property > value for each {{HealthCheckExecutorServlet$ProxyServlet}} instance. -- This message was sent by Atlassian Jira (v8.20.10#820010)