Thomas Driessen created FELIX-6049: -------------------------------------- Summary: ServletContextListener is not registered/working Key: FELIX-6049 URL: https://issues.apache.org/jira/browse/FELIX-6049 Project: Felix Issue Type: Bug Components: HTTP Service Affects Versions: http.jetty-4.0.6 Reporter: Thomas Driessen Fix For: http.jetty-4.0.8
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 Additional Information: The MySCL.java: @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"); } } Bundles running: 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.201902051255)|0.0.1.201902051255 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.6Li 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 List of components registered: io.jatoms.osgi.possiblebugs.scl.MyServlet in bundle 1 (io.jatoms.osgi.possiblebugs.scl.impl:0.0.1.201902051258) enabled, 1 instance. Id: 1, State:ACTIVE io.jatoms.osgi.possiblebugs.scl.MySCL in bundle 1 (io.jatoms.osgi.possiblebugs.scl.impl:0.0.1.201902051258) enabled, 1 instance. Id: 0, State:SATISFIED Info for MySCL component: Class: io.jatoms.osgi.possiblebugs.scl.MySCL Bundle: 1 (io.jatoms.osgi.possiblebugs.scl.impl:0.0.1.201902051258) Enabled: true Immediate: false Services: [javax.servlet.ServletContextListener] Scope: singleton Config PID(s): [io.jatoms.osgi.possiblebugs.scl.MySCL], Policy: optional Base Props: (1 entry) osgi.http.whiteboard.listener<Boolean> = true Component Configuration Id: 0 ----------------------------- State: SATISFIED Service: 50 [javax.servlet.ServletContextListener] Config Props: (3 entries) component.id<Long> = 0 component.name<String> = io.jatoms.osgi.possiblebugs.scl.MySCL osgi.http.whiteboard.listener<Boolean> = true References: (total 0) Is there anything wrong with this setup? Or is this a bug of felix.http? -- This message was sent by Atlassian JIRA (v7.6.3#76005)