2013/12/12 Jan Bartel <[email protected]>: > The method annotated with @PostConstruct will be called back by the > org.eclipse.jetty.plus.webapp.PlusDecorator. If you see the output, > then jetty's Decorator mechanism is working fine for listeners. As I > understand it, Weld adds in another Decorator to do its magic, so this > test will at least confirm that Decorators are being called. If you > see the output, then there must be something else in Weld that is not > working for listeners.
The postConstruct is duly called, but that's before the whole Jetty/Weld integration code is ever run (which is bootstrapped using their own listeners): klaus@klaus-dellnb:/opt/jetty-distribution-9.1.1-SNAPSHOT$ java -jar start.jar 2013-12-12 14:38:43.418:INFO:oejs.Server:main: jetty-9.1.1-SNAPSHOT 2013-12-12 14:38:43.446:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/opt/jetty-distribution-9.1.1-SNAPSHOT/webapps/] at interval 1 Dec 12, 2013 2:38:43 PM org.jboss.weld.bootstrap.WeldStartup <clinit> INFO: WELD-000900: 2.2.0 (2013-12-05 14:19) POST CONSTRUCT ON LISTENER CALLED test.ContextListener@744f45c Dec 12, 2013 2:38:44 PM org.jboss.weld.environment.servlet.BeanManagerResourceBindingListener contextInitialized INFO: BeanManager reference bound to java:comp/env/BeanManager Dec 12, 2013 2:38:44 PM org.jboss.weld.bootstrap.WeldStartup startContainer INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously. Dec 12, 2013 2:38:44 PM org.jboss.weld.environment.jetty.JettyContainer initialize INFO: Jetty 7.2+ detected, CDI injection will be available in Listeners, Servlets and Filters. Dec 12, 2013 2:38:45 PM org.jboss.weld.interceptor.util.InterceptionTypeRegistry <clinit> WARN: WELD-001700: Interceptor annotation class javax.ejb.PostActivate not found, interception based on it is not enabled Dec 12, 2013 2:38:45 PM org.jboss.weld.interceptor.util.InterceptionTypeRegistry <clinit> WARN: WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled ugh! injection into test.ContextListener failed! My understanding is that the Weld bootstrapping code should be executed before my own Listener is even instantiated (or at least immediately after that) so that injection can take place, but I have no idea how such ordering could be ensured in Jetty. BTW, I noticed that if I have my ContextListener both annotated as a WebListener *and* referenced in the web.xml, postConstruct is called several times (twice on the same instance apparently, and once on another instance). This seems to be a bug, or at least it's not what I'd expect: 2013-12-12 13:12:43.300:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/opt/jetty-distribution-9.1.1-SNAPSHOT/webapps/] at interval 1 Dec 12, 2013 1:12:43 PM org.jboss.weld.bootstrap.WeldStartup <clinit> INFO: WELD-000900: 2.2.0 (2013-12-05 14:19) POST CONSTRUCT ON LISTENER CALLED test.ContextListener@4bd38cb3 POST CONSTRUCT ON LISTENER CALLED test.ContextListener@744f45c POST CONSTRUCT ON LISTENER CALLED test.ContextListener@744f45c Dec 12, 2013 1:12:44 PM org.jboss.weld.environment.servlet.BeanManagerResourceBindingListener contextInitialized INFO: BeanManager reference bound to java:comp/env/BeanManager Dec 12, 2013 1:12:44 PM org.jboss.weld.bootstrap.WeldStartup startContainer INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously. Dec 12, 2013 1:12:44 PM org.jboss.weld.environment.jetty.JettyContainer initialize INFO: Jetty 7.2+ detected, CDI injection will be available in Listeners, Servlets and Filters. Dec 12, 2013 1:12:44 PM org.jboss.weld.interceptor.util.InterceptionTypeRegistry <clinit> WARN: WELD-001700: Interceptor annotation class javax.ejb.PostActivate not found, interception based on it is not enabled Dec 12, 2013 1:12:44 PM org.jboss.weld.interceptor.util.InterceptionTypeRegistry <clinit> WARN: WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled ugh! injection into test.ContextListener failed! Klaus _______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users
