Use the registered ClassLoaders to resolve and then use system class loader
548682
@Override
    protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
        for (ClassLoader loader : classLoaderRegistration) {
            try {
                return resolveClass(classDesc, loader);
            } catch (ClassNotFoundException e) {
                // ignore
            }
        }
        return super.resolveClass(classDesc);
    }
663736
private static ClassLoader getClassLoader() {
		ClassLoader ret = Thread.currentThread().getContextClassLoader();
		return ret != null ? ret : PathKit.class.getClassLoader();
	}
1233935
def load_dependencies_to_classpath
      jars = dependencies_classpath.split(File::PATH_SEPARATOR)
      Naether::Java.load_jars(jars)

      jars
    end
53226
void showClassesConfiguration() {

        // Warning about a classes folder present in the classpath:
        if (classesInClasspath != null) {
            log.warn("Dynamic class reloading is disabled because a classes URL is present in the classpath. P"
                    + "lease launch without including your classes directory: {}", classesInClasspath);
        }

        // Message to communicate the resolved configuration:
        String message;
        if (classesReloadable) {
            if (StringUtils.isNotBlank(packagePrefix)) {
                message = "Classes will be reloaded from: " + classesUrl;
            } else {
                message = "Classes will be reloaded from package " + packagePrefix + " at: " + classesUrl;
            }
        } else {
            message = "Classes will not be dynamically reloaded.";
        }
        log.info("Classes: {}", message);
    }
674593
static ClassLoader findClassLoader()
        throws ConfigurationError
    { 
        SecuritySupport ss = SecuritySupport.getInstance();

        // Figure out which ClassLoader to use for loading the provider
        // class.  If there is a Context ClassLoader then use it.
        ClassLoader context = ss.getContextClassLoader();
        ClassLoader system = ss.getSystemClassLoader();

        ClassLoader chain = system;
        while (true) {
            if (context == chain) {
                // Assert: we are on JDK 1.1 or we have no Context ClassLoader
                // or any Context ClassLoader in chain of system classloader
                // (including extension ClassLoader) so extend to widest
                // ClassLoader (always look in system ClassLoader if Xalan
                // is in boot/extension/system classpath and in current
                // ClassLoader otherwise); normal classloaders delegate
                // back to system ClassLoader first so this widening doesn't
                // change the fact that context ClassLoader will be consulted
                ClassLoader current = ObjectFactory.class.getClassLoader();

                chain = system;
                while (true) {
                    if (current == chain) {
                        // Assert: Current ClassLoader in chain of
                        // boot/extension/system ClassLoaders
                        return system;
                    }
                    if (chain == null) {
                        break;
                    }
                    chain = ss.getParentClassLoader(chain);
                }

                // Assert: Current ClassLoader not in chain of
                // boot/extension/system ClassLoaders
                return current;
            }

            if (chain == null) {
                // boot ClassLoader reached
                break;
            }

            // Check for any extension ClassLoaders in chain up to
            // boot ClassLoader
            chain = ss.getParentClassLoader(chain);
        };

        // Assert: Context ClassLoader not in chain of
        // boot/extension/system ClassLoaders
        return context;
    }
194191
function (classesSource)
		{
			this.e.log&&this.e.log('Importing core classes...','system');

			var classesSource = classesSource||global.wns.coreClasses;
			var classBuilder = new process.wns.wnBuild(classesSource,this);
			this.setComponent('classBuilder',classBuilder);
			classBuilder.build();

			return this;
		}
871592
public static ClassLoader[] getClassLoaders(ClassLoader... classLoaders) {

		if (classLoaders != null && classLoaders.length > 0) {
			return classLoaders;
		}

		final ClassLoader ctxClassLoader = Thread.currentThread()
				.getContextClassLoader();
		final ClassLoader staticClassLoader = ClassLoaderUtils.class
				.getClassLoader();

		if (ctxClassLoader == null) {
			if (staticClassLoader == null) {
				return new ClassLoader[] {};
			} else {
				return new ClassLoader[] { staticClassLoader };
			}
		} else {
			if (staticClassLoader == null) {
				return new ClassLoader[] { ctxClassLoader };
			} else {
				return new ClassLoader[] { ctxClassLoader, staticClassLoader };
			}
		}
	}
50654
private static Class resolveRClass(String packageName) {
        do {
            try {
                return Class.forName(packageName + ".R$string");
            } catch (ClassNotFoundException e) {
                packageName = packageName.contains(".") ? packageName.substring(0, packageName.lastIndexOf('.')) : "";
            }
        } while (!TextUtils.isEmpty(packageName));

        return null;
    }
623054
private ClassLoader getClassLoader()
        throws MojoExecutionException
    {
        List<URL> classpathURLs = new ArrayList<URL>();
        this.addRelevantPluginDependenciesToClasspath( classpathURLs );
        this.addRelevantProjectDependenciesToClasspath( classpathURLs );
        this.addAdditionalClasspathElements( classpathURLs );
        
        if (outputDirectory.isDirectory()) {
        	// load compiled classes
        	Collection listFiles = FileUtils.listFiles(outputDirectory, new String[]{"class"}, true);
        	for (Object object : listFiles) {
        		if (object instanceof File) {
        			File f = (File) object;
        			if (f.isFile()) {
        				try {
        					classpathURLs.add(f.toURI().toURL());
        				} catch (Exception e) {
        					// TODO: handle exception
        				}
        			}
        		}
        	}
        }
        
        
        return new URLClassLoader( classpathURLs.toArray( new URL[classpathURLs.size()] ) , getClass().getClassLoader());
    }
643362
public void resolveDependencies() {
		if (dependenciesResolved) {
			throw new Error("Can resolve dependencies only once");
		}
		dependenciesResolved = true;

		// resolve outer classes first
		for (ClassModel classModel : classes.values()) {
			classModel.resolveOuterClass();
		}

		// resolve used classes and the module
		for (ClassModel classModel : classes.values()) {
			classModel.resolveUsedClasses();
			if (classModel.outerClass == null) {
				classModel.resolveModule();
			}
		}

		// remove inner classes
		for (ClassModel classModel : new ArrayList<>(classes.values())) {
			if (classModel.outerClass != null) {
				// merge class with toplevel class
				classModel.getToplevelClass().usesClasses
						.addAll(classModel.usesClasses);
				classes.remove(classModel.getQualifiedName());
			}
		}

		for (ModuleModel moduleModel : modules.values()) {
			moduleModel.resolveDependencies();
		}

		calculateModuleDepenendencies();
	}
705255
public void updateAndRestart(ClassLoaderFiles files) {
		Set<URL> urls = new LinkedHashSet<>();
		Set<URL> classLoaderUrls = getClassLoaderUrls();
		for (SourceFolder folder : files.getSourceFolders()) {
			for (Entry<String, ClassLoaderFile> entry : folder.getFilesEntrySet()) {
				for (URL url : classLoaderUrls) {
					if (updateFileSystem(url, entry.getKey(), entry.getValue())) {
						urls.add(url);
					}
				}
			}
			urls.addAll(getMatchingUrls(classLoaderUrls, folder.getName()));
		}
		updateTimeStamp(urls);
		restart(urls, files);
	}
398867
public ConfigurationBuilder addClassLoaders(ClassLoader... classLoaders) {
        this.classLoaders = this.classLoaders == null ? classLoaders : ObjectArrays.concat(this.classLoaders, classLoaders, ClassLoader.class);
        return this;
    }
92648
private static ClassLoader extensionClassLoader(final ClassLoader environment) {
    ClassLoader cl = environment;
    ClassLoader prev = null;
    while (cl != null) {
      prev = cl;
      cl = cl.getParent();
    }
    return prev;
  }
668261
public static ClassLoader getClassLoader(Class<?> clazz) {
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        if (loader != null) {
            return loader;
        }
        if (clazz != null) {
            loader = clazz.getClassLoader();
            if (loader != null) {
                return loader;
            }
        }
        return ClassLoader.getSystemClassLoader();
    }
573072
private ProviderClassLoader loadClasses(ClassSource soruce) throws Exception 
	{
		ProviderClassLoader loader=new ProviderClassLoader(parentClassLoader);
		Set<Class<?>> allClass = loader.getAllClass();
		List<ClassSourceInfo> sources=soruce.getClassSources();
		if(sources.isEmpty())
		{
			return loader;
		}
		for(ClassSourceInfo cs:sources)
		{
			loader.addURL(cs.getUrl());
			for(String className:cs.getClassNames())
			{
				Class<?> clazz=loader.loadClass(className);
				if(clazz!=null)
				{
					allClass.add(clazz);
				}
			}
		}
		_log.debug("classloader init complete,find Class:"+allClass.size());
		return loader;
	}
1224823
protected void initialize(ConfigurableEnvironment environment,
			ClassLoader classLoader) {
		new LoggingSystemProperties(environment).apply();
		LogFile logFile = LogFile.get(environment);
		if (logFile != null) {
			logFile.applyToSystemProperties();
		}
		initializeEarlyLoggingLevel(environment);
		initializeSystem(environment, this.loggingSystem, logFile);
		initializeFinalLoggingLevels(environment, this.loggingSystem);
		registerShutdownHookIfNecessary(environment, this.loggingSystem);
	}
429528
@Override
    @Trivial
    public void addClassLoader(ClassLoader classLoader) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "addClassLoader - " + classLoader);
        }

        if (classLoader instanceof ContainerClassLoader) {
            synchronized (classLoaders) {
                classLoaders.add((ContainerClassLoader) classLoader);
            }
        } else {
            throw new IllegalArgumentException("classLoader is not a ContainerClassLoader");
        }
    }