Hi Thomas, I wonder if you have found an answer to your issue with ServletContextListener since I have the same problem here. I'm using paxweb and their example/test don't use DS annotation but register the component directly with httpservice.
Thai On Sat, Feb 2, 2019 at 11:00 AM Thomas Driessen via osgi-dev < osgi-dev@mail.osgi.org> wrote: > Hi Dirk, > > I've read all of your great blog post. By the way thank you for those . > Unfortunately, in those you do exact the same things as I did in my example. > > The servlet looks like this: > > @Component(service = Servlet.class, scope = ServiceScope.PROTOTYPE) > public class MyServlet extends HttpServlet{ > > protected void doGet(HttpServletRequest req, HttpServletResponse resp) > throws IOException { > resp.setContentType("text/plain"); > resp.getWriter().println("Hello World!"); > } > } > > and the ServletContextListener like this: > > @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"); > } > } > > I think by using the new annotations everything should be set up right. > The Servlet works as expected, but the SCL is never called. > > In contrast to your blog post examples I didn't use any specific > ServletContext(Helper), but I thought this would lead to using the default > ServletContext. I think in most of my cases I do not need to use a specific > ServletContext,, so the default would be sufficient. > > Kind regards, > Thomas > > > > Am Sa., 2. Feb. 2019 um 16:50 Uhr schrieb Dirk Fauth <dirk.fa...@gmail.com > >: > >> Hi, >> >> Not sure if this helps, but I wrote a blog post a while ago where I also >> used a ServletContextListener in my example. >> >> http://blog.vogella.com/2017/04/20/access-osgi-services-via-web-interface/ >> >> Maybe it helps in finding the cause. >> >> Are you using the http whiteboard pattern and did you set the required >> component property? >> >> Greez, >> Dirk >> >> Am Sa., 2. Feb. 2019, 16:07 hat Thomas Driessen via osgi-dev < >> osgi-dev@mail.osgi.org> geschrieben: >> >>> Hi, >>> >>> 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 >>> _______________________________________________ >>> OSGi Developer Mail List >>> osgi-dev@mail.osgi.org >>> https://mail.osgi.org/mailman/listinfo/osgi-dev >> >> _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev -- Castor Technologies Inc 460 rue St-Catherine St Ouest, Suite 613 Montréal, Québec H3B-1A7 (514) 360-7208 o (514) 798-2044 f n...@castortech.com www.castortech.com CONFIDENTIALITY NOTICE: The information contained in this e-mail is confidential and may be proprietary information intended only for the use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any viewing, dissemination, distribution, disclosure, copy or use of the information contained in this e-mail message is strictly prohibited. If you have received and/or are viewing this e-mail in error, please immediately notify the sender by reply e-mail, and delete it from your system without reading, forwarding, copying or saving in any manner. Thank you. AVIS DE CONFIDENTIALITE: L’information contenue dans ce message est confidentiel, peut être protégé par le secret professionnel et est réservé à l'usage exclusif du destinataire. Toute autre personne est par les présentes avisée qu'il lui est strictement interdit de diffuser, distribuer ou reproduire ce message. Si vous avez reçu cette communication par erreur, veuillez la détruire immédiatement et en aviser l'expéditeur. Merci.
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev