code: private static void validateJndiLookup(String lookupString, Annotated annotated, Class<?> declaringClass, CDIArchive cdiArchive) {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.entry(tc, "validateJndiLookup", new Object[] { Util.identity(annotated), declaringClass, cdiArchive });
          }
          // We need to set a current component before doing anything to do with JNDI
          CDIRuntime cdiRuntime = cdiArchive.getCDIRuntime();
          try {
              cdiRuntime.beginContext(cdiArchive);
              InitialContext c = new InitialContext();
  
              validateJndiLookup(c, lookupString, annotated, declaringClass, cdiArchive);
  
          } catch (NamingException ex) {
              // Failed to look up the object, just return without failing validation
          } catch (CDIException e) {
              throw new IllegalStateException(e);
          } finally {
              cdiRuntime.endContext();
          }
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.exit(tc, "validateJndiLookup", new Object[] { Util.identity(annotated) });
          }
      }
docs: Validates that the object referenced by a JNDI name has the given type
  <p>
  Validation is lenient, if we can't find the object for any reason, we won't fail validation.
  
  @throws DefinitionException if the object is found and does not have the correct type