1 Reply Latest reply on Nov 26, 2015 12:12 PM by Luca Stancapiano

    Wildfly and CDI Bean Manager Injection and lookup

    Luca Stancapiano Expert

      I see that I cannot do a lookup of cdi BeanManager in wildfly 9.0.2. Here how I do the lookup and the injection in a simple servlet sample:

       

      import javax.enterprise.inject.spi.BeanManager;

      ....

       

      @Inject

      private BeanManager beanManager;

       

      ......

       

      protected void doGet(HttpServletRequest request, HttpServletResponse response)

                  throws ServletException, IOException {

                 try {

                     InitialContext.doLookup("java:comp/BeanManager");

                     System.out.println(beanManager);

                  } catch (NamingException e) {

                        e.printStackTrace();

                  }

      }

      .....

       

      Either the lookup or the injection no return results. Do I miss something?