[ https://issues.apache.org/jira/browse/FELIX-6791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17993157#comment-17993157 ]
Jonathan Wright edited comment on FELIX-6791 at 7/3/25 9:27 PM: ---------------------------------------------------------------- [~paulrutter] - Thank you for picking this up so quickly. I'm unable to test this as Karaf ships with Pax Web 8.30.0, which is still using {{{}javax.servlet{}}}. I'm happy to backport your fix to a new 2.0.16 branch for those limited to 2.0.x due to the move to {{jakarta.servlet}} in 2.1.0. I have tested Pax Web 8.30.0 by registering multiple instances of the same {{Servlet}} class by specifying a unique {{osgi.http.whiteboard.servlet.name}} value for each instance, and it does work. So I'm pretty certain your fix is correct. was (Author: JIRAUSER310126): [~paulrutter] - Thank you for picking this up so quickly. I'm unable to test this as Karaf ships with Pax Web 8.30.0, which is still using {{{}javax.servlet{}}}. I'm happy to backport your fix to a new 2.0.18 branch for those limited to 2.0.x due to the move to {{jakarta.servlet}} in 2.1.0. I have tested Pax Web 8.30.0 by registering multiple instances of the same {{Servlet}} class by specifying a unique {{osgi.http.whiteboard.servlet.name}} value for each instance, and it does work. So I'm pretty certain your fix is correct. > 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)