code: public ClassLoader getRealAppClassLoader(Application application) {
          try {
              List<CDIArchive> moduleArchives = new ArrayList<CDIArchive>(application.getModuleArchives());
              if (moduleArchives.isEmpty()) {
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                      Tr.debug(tc, Util.identity(this), "Application {0} has no modules so no thread context class loader will be set, this is expected for an OSGI app.",
                               application);
                  }
                  return null;
              }
              if (moduleArchives.size() == 1 && ArchiveType.WEB_MODULE == moduleArchives.get(0).getType()) {
                  return moduleArchives.get(0).getClassLoader();
              }
  
              return application.getClassLoader();
          } catch (CDIException e) {
              return null;
          }
      }
docs: If we are deploying a WAR file (which gets wrapped into a synthetic EAR by WAS)
  we need to take the webapp classloader, because the surrounding EAR class loader
  actually doesn't even contain a single class...