junit-team/junit5 · error · JUnitException

Failed to close custom class loader

Error message

Failed to close custom class loader

What it means

Error "Failed to close custom class loader" thrown in junit-team/junit5.

Source

Thrown at junit-platform-console/src/main/java/org/junit/platform/console/command/CustomClassLoaderCloseStrategy.java:38

 * discovery and execution.
 */
@API(status = INTERNAL, since = "1.13")
public enum CustomClassLoaderCloseStrategy {

	/**
	 * Close the custom class loader after calling the
	 * {@link org.junit.platform.launcher.Launcher} for test discovery or
	 * execution.
	 */
	CLOSE_AFTER_CALLING_LAUNCHER {

		@Override
		void handle(CustomClassLoader customClassLoader) {
			try {
				customClassLoader.close();
			}
			catch (Exception ex) {
				throw new JUnitException("Failed to close custom class loader", ex);
			}
		}
	},

	/**
	 * Rely on the JVM to release resources held by the custom class loader when
	 * it terminates.
	 *
	 * <p>This mode is only safe to use when calling {@link System#exit(int)}
	 * afterward.
	 */
	KEEP_OPEN {

		@Override
		void handle(CustomClassLoader customClassLoader) {
			// do nothing
		}
	};

View on GitHub (pinned to 956246301e)

When it happens

Trigger: Thrown at junit-platform-console/src/main/java/org/junit/platform/console/command/CustomClassLoaderCloseStrategy.java:38 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of junit-team/junit5@956246301e (2026-08-04). Data as JSON: /data/errors/aefe55cef64d1fbf.json. Report an issue: GitHub.