Hello So back to the case you've described in your email "error page servlet register twice" ;)
Is there a chance to get some logs? regards Grzegorz Grzybek wt., 10 wrz 2019 o 16:25 Nhut Thai Le <[email protected]> napisaĆ(a): > Thank you Grzegorz, > > I did what you said and the error does go away but from time to time i got > this: > > java.lang.IllegalArgumentException > <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+illegalargumentexception>: > Error > <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+error> > page for [403] already registered. > at > org.ops4j.pax.web.service.spi.model.ServiceModel.addErrorPageModel(ServiceModel.java:315) > at > org.ops4j.pax.web.service.internal.HttpServiceStarted.registerErrorPage(HttpServiceStarted.java:961) > at > org.ops4j.pax.web.service.internal.HttpServiceProxy.registerErrorPage(HttpServiceProxy.java:343) > at > org.ops4j.pax.web.extender.whiteboard.internal.element.ServletWebElement.register(ServletWebElement.java:107) > at > org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.registerWebElement(WebApplication.java:392) > > > Is it possible that this is due to race condition in scr? > > Thai > > On Tuesday, August 6, 2019 at 1:28:13 PM UTC-4, Nhut Thai Le wrote: >> >> 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", >> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name >> =WebviewerServletContextHelper)" >> }, >> scope = ServiceScope.PROTOTYPE >> ) >> public final class Error403Servlet extends HttpServlet {...} >> >> @Component( >> service = Servlet.class, >> enabled=true, >> property = { >> "osgi.http.whiteboard.servlet.errorPage=404", >> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name >> =WebviewerServletContextHelper)" >> }, >> scope = ServiceScope.PROTOTYPE >> ) >> public final class Error404Servlet extends HttpServlet {..} >> >> @Component( >> service = Servlet.class, >> enabled=true, >> property = { >> "osgi.http.whiteboard.servlet.errorPage=500", >> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name >> =WebviewerServletContextHelper)" >> }, >> 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 >> > -- > -- > ------------------ > OPS4J - http://www.ops4j.org - [email protected] > > --- > You received this message because you are subscribed to the Google Groups > "OPS4J" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ops4j/be34dfba-9b9b-4051-9f48-547322ab5ce2%40googlegroups.com > <https://groups.google.com/d/msgid/ops4j/be34dfba-9b9b-4051-9f48-547322ab5ce2%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- -- ------------------ OPS4J - http://www.ops4j.org - [email protected] --- You received this message because you are subscribed to the Google Groups "OPS4J" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/CAAdXmhq-xNk8AO8aFjAj47bnTsr0bHFwzRAC83X4Tara06jAyA%40mail.gmail.com.
