Hi Thomas,

The spec states in section 140.7 [1]
"Events are sent to listeners registered in the Service Registry with the
osgi.http.whiteboard.listener service property set to true"

Did you set this service property?
There is a constant for it in
org.osgi.service.http.whiteboard.HttpWhiteboardConstants [2]

Hope this helps,

David

[1]
https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#d0e75952
[2]
https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#org.osgi.service.http.whiteboard.HttpWhiteboardConstants

On Mon, 4 Feb 2019 at 06:38, Thomas Driessen <thomas.driessen...@gmail.com>
wrote:

> I've investigated this further and in the Apache Felix Web Console my
> listener is listed under the "Failed Listeners". As reason "Invalid" is
> shown.
>
> I do not know what I'm doing wrong :(
>
> This is my ServletContextListener:
>
>                 @Component
> @HttpWhiteboardListener
> public class MySCL implements ServletContextListener {
>
>      @Override
>      public void contextDestroyed(ServletContextEvent arg0) {
>          System.out.println("Destroyed");
>      }
>
>      @Override
>      public void contextInitialized(ServletContextEvent arg0) {
>          System.out.println("Initialized");
>      }
>
> }
>
> Any idea what I'm missing?
>
> Kind regards,
> thomas
>
> ------ Originalnachricht ------
> Von: "Thomas Driessen" <thomas.driessen...@gmail.com>
> An: "users@felix.apache.org" <users@felix.apache.org>
> Gesendet: 04.02.2019 09:48:35
> Betreff: ServletContextListener not working?
>
> >Hi,
> >
> >I've already asked on the general OSGi Dev mailing list, but I think
> >this might be a more appropriate place to ask:
> >
> >I just tried to get a ServletContextListener to work, but did not
> >succeed, although everything is done as defined by the spec.
> >
> >Here you can find a minimal example of my setup
> >https://github.com/Sandared/io.jatoms.osgi.possiblebugs.scl
> >
> >The Servlet I'm registering is working fine, but the
> >ServletContextListener that I registered too is never called.
> >Even if I call getServletContext() from within the Servlet, my Listener
> >is never called.
> >
> >I would have expected the ServletContextListener to be called at least
> >once, after a DefaultServletContext has been created by the
> >ServletContainer, or am I wrong with this assumption?
> >
> >Kind regards,
> >Thomas

Reply via email to