Thomas did you check that your tool chain processed the annotation `@HttpWhiteboardListener` into the appropriate service property?
- Ray On Mon, Feb 4, 2019 at 10:05 AM Thomas Driessen < thomas.driessen...@gmail.com> wrote: > BTW the version of felix http is 4.0.6 and the other bundles installed and > active are: > > START LEVEL 1 > ID|State |Level|Name > 0|Active | 0|OSGi System Bundle > (3.13.100.v20180827-1536)|3.13.100.v20180827-1536 > 1|Active | 1|osgi.possiblebugs.scl.impl > (0.0.1.201902041434)|0.0.1.201902041434 > 2|Active | 1|Apache Commons FileUpload (1.3.3)|1.3.3 > 3|Active | 1|Apache Commons IO (2.6.0)|2.6.0 > 4|Active | 1|Apache Felix Gogo Command (1.0.2)|1.0.2 > 5|Active | 1|Apache Felix Gogo Runtime (1.0.10)|1.0.10 > 6|Active | 1|Apache Felix Gogo Shell (1.0.0)|1.0.0 > 7|Active | 1|Apache Felix Http Jetty (4.0.6)|4.0.6 > 8|Active | 1|Apache Felix Servlet API (1.1.2)|1.1.2 > 9|Active | 1|Apache Felix Inventory (1.0.4)|1.0.4 > 10|Active | 1|Apache Felix Declarative Services (2.1.10)|2.1.10 > 11|Active | 1|Apache Felix Web Management Console (4.3.4)|4.3.4 > 12|Active | 1|Apache Felix Web Console Service Component > Runtime/Declarative Services Plugin (2.0.8)|2.0.8 > 13|Active | 1|org.osgi:org.osgi.util.function > (1.1.0.201802012106)|1.1.0.201802012106 > > Any idea what might be missing? > > Kind regards, > Thomas > > ------ Originalnachricht ------ > Von: "Thomas Driessen" <thomas.driessen...@gmail.com> > An: "David Bosschaert" <david.bosscha...@gmail.com>; > users@felix.apache.org > Gesendet: 04.02.2019 16:03:25 > Betreff: Re[2]: ServletContextListener not working? > > Hi David, > > yes this is done via tha @HttpWhiteboardListener annotation. The > webconsole shows me this output for the MySCL component: > > > ------ Originalnachricht ------ > Von: "David Bosschaert" <david.bosscha...@gmail.com> > An: users@felix.apache.org; "Thomas Driessen" < > thomas.driessen...@gmail.com> > Gesendet: 04.02.2019 15:44:52 > Betreff: Re: ServletContextListener not working? > > 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 > > -- *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile> (@rotty3000) Senior Software Architect *Liferay, Inc.* <http://www.liferay.com> (@Liferay) Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)