Skip to content

java.lang.IllegalArgumentException: Error: test loader org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader not found #1816

Open

Description

@rbyjoswald

I get the above exception in the Debug Console when trying to run unit tests. To be honest, I'm lost as to why.

redhat.java: 1.49.0
vscjava.vscode-java-test: 0.43.2
VS Code: 1.106.2

Full Stack:

java.lang.IllegalArgumentException: Error: test loader org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader not found:
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
NativeConstructorAccessorImpl.java:77
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
DelegatingConstructorAccessorImpl.java:45
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
Constructor.java:500
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
Constructor.java:481
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(RemoteTestRunner.java:372)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(RemoteTestRunner.java:367)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(RemoteTestRunner.java:311)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.init(RemoteTestRunner.java:226)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: java.lang.NoSuchMethodError: 'void org.junit.platform.commons.util.CollectionUtils.forEachInReverseOrder(java.util.List, java.util.function.Consumer)'
	at org.junit.platform.launcher.core.LauncherConfigurationParameters$Builder.build(LauncherConfigurationParameters.java:143)
	at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:129)
	at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:112)
	at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.<init>(JUnit5TestLoader.java:37)
	... 10 more

	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(RemoteTestRunner.java:377)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(RemoteTestRunner.java:367)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(RemoteTestRunner.java:311)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.init(RemoteTestRunner.java:226)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)

Test related configs from build.gradle:

	testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3'
	testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3'
	testImplementation('org.springframework.boot:spring-boot-starter-test') {
		exclude group: 'junit', module: 'junit'
	}
	testCompile "org.mockito:mockito-core:2.+"
	testCompileOnly 'junit:junit:4.13.2'
	testCompileOnly 'org.projectlombok:lombok'
	testAnnotationProcessor 'org.projectlombok:lombok'

Any idea what could be the culprit? Thx!

Activity

  1. github-actions commented on Nov 24, 2025

    @github-actions

    Hi rbyjoswald, I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

    It looks like the JUnit5 loader in the VS Code extension now calls CollectionUtils.forEachInReverseOrder, which was only added in JUnit Platform 1.10. Your project is on JUnit 5.9.3 (Platform 1.9.3), so the method can’t be found. To fix it, upgrade to JUnit 5.10+ (which brings in Platform 1.10+):

    • In build.gradle, bump your JUnit dependencies:

    dependencies {
      testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
      testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0'
      // …other deps…
    }

    • Alternatively, add an explicit Platform Commons override:

    dependencies {
      testImplementation 'org.junit.platform:junit-platform-commons:1.10.0'
      // …
    }

    This aligns your platform version with what the JUnit5TestLoader expects.

    Duplicate of:

    Other references with low confidence

    The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

  2. DrewCCannedy commented on Jan 13, 2026

    @DrewCCannedy

    So we are forced to opt in to the new JUnit version to run tests now??? What if we want to open a legacy project?

  3. wenytang-ms commented on Mar 3, 2026

    @wenytang-ms
    Contributor

    rbyjoswald Drew Cannedy (@DrewCCannedy)
    we shipped a fix pre-release 0.44.2026030208 to vscjava.vscode-java-test, and the pre-release 3.17.2026022802 to Gradle for Java. please install these two bits and verify this issue.
    if not, please share your project and details about your java project to help us repro this issue.

  4. DrewCCannedy commented on Mar 3, 2026

    @DrewCCannedy

    It did not completely solve the issue, no.

    The project is a multi-module Gradle project. There is a parent project in the root directory, a few apps in an /app directory, and a library shared by the apps in /lib.

    The test runner runs the tests for the projects in /app with no issues, but running tests in the library outputs the following exception

    java.lang.NoClassDefFoundError: org/junit/platform/engine/OutputDirectoryCreator
    at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createFilteredTest(JUnit5TestLoader.java:73)
    at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createTest(JUnit5TestLoader.java:67)
    at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.loadTests(JUnit5TestLoader.java:56)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:504)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:748)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:443)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:211)
    Caused by: java.lang.ClassNotFoundException: org.junit.platform.engine.OutputDirectoryCreator
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
    ... 7 more

    Below is the gradle build file for the library

    plugins {
        `java-library`
        `java-test-fixtures`
        id("org.springframework.boot") version "3.4.8" apply false
        id("io.spring.dependency-management") version "1.1.6"
    }
    
    java {
        toolchain {
            languageVersion = JavaLanguageVersion.of(21)
        }
    }
    
    dependencyManagement {
        imports {
            mavenBom(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
        }
    }
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        api("org.springframework.boot:spring-boot-starter-data-jpa")
        api("org.springframework.boot:spring-boot-starter-webflux")
        api("org.springframework.boot:spring-boot-starter-actuator")
        api("org.springframework.boot:spring-boot-starter-validation")
    
        runtimeOnly("org.postgresql:postgresql")
    
        testImplementation("org.springframework.boot:spring-boot-starter-test")
        testImplementation("io.projectreactor:reactor-test")
        testRuntimeOnly("com.h2database:h2")
    
        testFixturesApi("org.springframework.boot:spring-boot-starter-data-jpa")
        testFixturesApi("org.springframework.boot:spring-boot-starter-webflux")
        testFixturesApi("org.springframework.boot:spring-boot-starter-test")
    }
    
    tasks.withType<JavaCompile>().configureEach {
        options.compilerArgs.add("-parameters")
    }
    
    tasks.withType<Test> {
        useJUnitPlatform()
    }
  5. wenytang-ms commented on Mar 6, 2026

    @wenytang-ms
    Contributor

    Drew Cannedy (@DrewCCannedy) can you share your project to repro this issue?

  6. DrewCCannedy commented on Mar 9, 2026

    @DrewCCannedy

    example.zip

    Can't share the exact project but here's a minimal example that has the same issue. Running tests via the explorer works in app/example-payments-scheduler but not lib/example-payments-core

  7. wenytang-ms commented on Mar 10, 2026

    @wenytang-ms
    Contributor

    Hi Drew Cannedy (@DrewCCannedy) I can load the lib/example-payments-core success

    Image

    with the following versions

    test-runner: 0.44.2026030602
    vscode gradle: 3.17.2026022802
    

    please help verify your project with these prerelease bits. thanks

  8. wenytang-ms commented on Mar 11, 2026

    @wenytang-ms
    Contributor

    rbyjoswald Drew Cannedy (@DrewCCannedy) please help verify against this issue with version above, if you repro such bug, please reopen this issue.
    thanks!

  9. rbyjoswald commented on Mar 11, 2026

    @rbyjoswald
    Author

    For me the initial bot-response to my original question has already helped resolve the issue. I did not follow the subsequent thread.

  10. DrewCCannedy commented on Mar 11, 2026

    @DrewCCannedy

    wenyt (@wenytang-ms) Loading isn't the issue, the issue is running the tests. I am using both versions you suggested and still get this error in the debug console when running the core tests.

    java.lang.NoClassDefFoundError: org/junit/platform/engine/OutputDirectoryCreator
    at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createUnfilteredTest(JUnit5TestLoader.java:78)
    at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createTest(JUnit5TestLoader.java:69)
    at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.loadTests(JUnit5TestLoader.java:56)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:504)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:748)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:443)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:211)
    Caused by: java.lang.ClassNotFoundException: org.junit.platform.engine.OutputDirectoryCreator
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
    ... 7 more

  11. wenytang-ms commented on Apr 27, 2026

    @wenytang-ms
    Contributor

    Drew Cannedy (@DrewCCannedy)
    Thanks for the repro. I looked into this further and this appears to be caused by mixed JUnit Platform versions on the test runtime
    classpath.

    The VS Code/JDT test runner may use a newer JUnit Platform launcher, while the project classpath can still provide an older
    junit-platform-engine or junit-platform-commons first. That can lead to errors like:

    • NoSuchMethodError: CollectionUtils.forEachInReverseOrder(...)
    • NoClassDefFoundError: org/junit/platform/engine/OutputDirectoryCreator

    As a workaround, could you try making the JUnit Platform versions explicit and consistent in the affected module? For example, add
    matching versions of:

    • org.junit.platform:junit-platform-launcher
    • org.junit.platform:junit-platform-engine
    • org.junit.platform:junit-platform-commons

    For your Spring Boot 3.4.x project, using the versions managed by the Spring Boot BOM should be the safest option. If Gradle still
    resolves mixed versions, please try forcing/aligning those three artifacts to the same version in the module where the test fails.

    We will keep this issue open since the runner should ideally detect or avoid this mixed-version classpath situation more gracefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions