code: public static BeanManager getBeanManager() {
          try {
              InitialContext initialContext = new InitialContext();
              return (BeanManager) initialContext.lookup("java:comp/BeanManager");
          }
          catch (NamingException e) {
              if (beanManager != null) {
                  return beanManager;
              }
              throw new IllegalStateException(
                  "BeanManager not found in JNDI and not set via setBeanManager()");
          }
      }
docs: Looks up the current bean manager in JNDI, or returns the value set by
  {@link #setBeanManager(BeanManager)} as fallback.
  
  @return