code: public static Object lookup(String name)
    {
      Exception ex = null;
  
      try {
        Object value = new InitialContext().lookup(name);
          
        if (value != null)
          return value;
      } catch (NamingException e) {
        ex = e;
      }
  
      if (! name.startsWith("java:")) {
        try {
          Object value = new InitialContext().lookup("java:comp/env/" + name);
          
          if (value != null)
            return value;
        } catch (NamingException e) {
          ex = e;
        }
      }
  
      if (ex != null && log.isLoggable(Level.FINEST))
        log.log(Level.FINEST, ex.toString(), ex);
  
      return null;
    }
docs: For EL