Hello,
I have a few error page servlets to handle 403, 404 and 500 errors. They are annotated according to osgi cmpn R6 as follow:
@Component(
service = Servlet.class,
enabled=true,
property = {
"osgi.http.whiteboard.servlet.errorPage=403",
},
scope = ServiceScope.PROTOTYPE
)
public final class Error403Servlet extends HttpServlet {...}
@Component(
service = Servlet.class,
enabled=true,
property = {
"osgi.http.whiteboard.servlet.errorPage=404",
},
scope = ServiceScope.PROTOTYPE
)
public final class Error404Servlet extends HttpServlet {..}
@Component(
service = Servlet.class,
enabled=true,
property = {
"osgi.http.whiteboard.servlet.errorPage=500",
},
scope = ServiceScope.PROTOTYPE
)
public final class Error500Servlet extends HttpServlet {..}
When i start the server, i got this error:
13:13:53.716 [paxweb-config-1-thread-1] ERROR o.o.p.w.e.w.i.WebApplication - Registration skipped for [ServletWebElement{mapping=DefaultServletMapping{httpContextId=WebviewerServletContextHelper,urlPatterns=null,initParams={},servlet=com.castortech.iris.ba.webviewer.internal.Error500Servlet@1399c32a, alias=/errorServlet, servletNameError500Servlet}}] due to error during registration
org.osgi.service.http.NamespaceException: alias: '/errorServlet' is already in use in this or another context
at org.ops4j.pax.web.service.spi.model.ServerModel.addServletModel(ServerModel.java:124)
at org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:243)
at org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:223)
at org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:207)
at org.ops4j.pax.web.service.internal.HttpServiceProxy.registerServlet(HttpServiceProxy.java:69)
at org.ops4j.pax.web.extender.whiteboard.internal.element.ServletWebElement.register(ServletWebElement.java:88)
Tracing the code to the ServletWebElement.register(), i see that all my error page servlets above have the same alias (/errorServlet) which cause pax.web to throw exception and skip registration when it encounter the 2nd error page servlet. Is this a known bug and how do I get around this?
I am using pax-web-extender-whiteboard 7.2.4
Thai Le