Hi Thomas and Grzegorz,

I cannot say whether this problem still exists, because I rolled back the
affected installation to Karaf 4.3.
I hope I can find this week some time to reproduce the problem (and to test
your proposed fix).

Does PAX-WEB 8 produce a warning in the logs when such a situation is
detected (two or or more servlets with the same name in the same context)?

Is it possible that PAX-WEB generates an unique name for servlets without a
servlet name?

Sorry for the delayed answer, I was also on holiday.

Thank you

  Richard


Am Do., 18. Aug. 2022 um 11:34 Uhr schrieb Thomas Driessen <
[email protected]>:

> Hi Richard,
>
> not sure if this issue is still open for you, but what I observed in a
> similar case is, that if there are two servlets with the same name in the
> same context, this leads to one of them not being registered.
> As the default name for your servlet would be javax.servlet.Servlet this
> might cause your observed behavior.
>
> In my case I solved this, by explicitly naming all my Servlets
> via @HttpWhiteboardServletName("my-unique-name")
>
> Hope that helps.
>
> Kind regards,
> Thomas
>
> Am Di., 16. Aug. 2022 um 12:50 Uhr schrieb Grzegorz Grzybek <
> [email protected]>:
>
>> Hello
>>
>> If you set DEBUG logging level for org.ops4j.pax.web logger, you should
>> see A LOT of information about how servlets are discovered and registered
>> into the runtime. Without the logs, I can't tell much - especially if (as
>> you've mentioned) it's sporadic problem...
>>
>> regards
>> Grzegorz Grzybek
>>
>> pon., 8 sie 2022 o 08:23 Richard Hierlmeier <[email protected]>
>> napisaƂ(a):
>>
>>>
>>> I upgraded last week a system to Karaf 4.4.1. I have a sporadic problem
>>> with this system.
>>>
>>> The system contains a small bundle with this default servlet:
>>>
>>> @Component(service = Servlet.class, scope = ServiceScope.PROTOTYPE)
>>> @HttpWhiteboardServletPattern("/")
>>> @HttpWhiteboardContextSelect("(osgi.http.whiteboard.context.path=/)")
>>> public class RootServlet extends HttpServlet {
>>>
>>>     @Override
>>>     protected void doGet(final HttpServletRequest req, final
>>> HttpServletResponse resp)
>>>             throws ServletException, IOException {
>>>         resp.sendRedirect("/welcome/welcome.html");
>>>     }
>>> }
>>>
>>> However sometimes after the start of Karaf the bundle is active but this
>>> servlet is not available:
>>>
>>> de@root()> la -u | grep  web-root
>>>  37 | Active   |  80 | 1.0.0.SNAPSHOT                      |
>>> mvn:de.hierlmeier.testPaxWeb8/web-root/1.0.0-SNAPSHOT
>>>
>>> de@root()> ls javax.servlet.Servlet
>>> [javax.servlet.Servlet]
>>> -----------------------
>>>  component.id = 20
>>>  component.name = de.hierlmeier.testPaxWeb8.webRoot.RootServlet
>>>  osgi.ds.satisfying.condition.target = (osgi.condition.id=true)
>>>  osgi.http.whiteboard.context.select =
>>> (osgi.http.whiteboard.context.path=/)
>>>  osgi.http.whiteboard.servlet.pattern = [/]
>>>  service.bundleid = 37
>>>  service.id = 206
>>>  service.scope = prototype
>>> Provided by :
>>>   web-root  (37)
>>> Used by:
>>>   web-root  (37)
>>>
>>> de@root()> web:servlet-list | grep RootServlet
>>> de@root()>
>>>
>>> How can I diagnose this problem?
>>>
>>> I am running Karaf 4.4.1 with PAX-WEB 8.0.6 on Java 8.
>>>
>>> Regards
>>>
>>>   Richard
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>

Reply via email to