private void loadClassesWithCustomClassLoader() throws ClassNotFoundException {
    String classPath = System.getProperty("java.class.path");
    StringTokenizer st = new StringTokenizer(classPath, ":");
    List<URL> urls = new ArrayList<>();
    while (st.hasMoreTokens()) {
      String u = st.nextToken();
      // Because of LOG4J2-2266 and LOG4J-2152 ignore all log4j related jars and let them be picked
      // up from the system classloader. Although it's supposed to be fixed in log4j 2.10, it does
      // not seem to be.
      if (u.contains("log4j")) {
        continue;
      }
      try {
        if (!u.endsWith(".jar")) {
          u += "/";
        }
        URL url = new URL("file://" + u);
        urls.add(url);
      } catch (MalformedURLException e) {
        e.printStackTrace();
      }
    }

    ClassLoader classLoader = new ChildFirstClassLoader(urls.toArray(new URL[] {}),
        Thread.currentThread().getContextClassLoader());

    Thread.currentThread().setContextClassLoader(classLoader);

    testClassFromClassLoader =
        new TestClass(classLoader.loadClass(getTestClass().getJavaClass().getName()));
    // See withAfters and withBefores for the reason.
    beforeFromClassLoader = classLoader.loadClass(Before.class.getName());
    afterFromClassLoader = classLoader.loadClass(After.class.getName());
    ruleFromClassLoader = classLoader.loadClass(Rule.class.getName());
    testRuleFromClassLoader = classLoader.loadClass(TestRule.class.getName());
    methodRuleFromClassLoader = classLoader.loadClass(MethodRule.class.getName());
  }
Load classes (TestCase, @Before and @After with custom class loader.

@throws ClassNotFoundException the class not found exception
extensions/geode-modules-session/src/integrationTest/java/org/apache/geode/modules/session/junit/PerTestClassLoaderRunner.java