JUnit5TestLoader fails with NoSuchMethodError on CollectionUtils.forEachInReverseOrder #78

Open
opened 2026-03-19 16:57:32 +00:00 by automation · 0 comments
Collaborator

Bug Report

Problem

When running tests via jdt_run_tests, the JUnit5 test loader fails to initialize. All test runs end with a TIMEOUT.

Error

java.lang.IllegalArgumentException: Error: test loader org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader not found:
java.lang.reflect.InvocationTargetException
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:130)
    at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:113)
    at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.<init>(JUnit5TestLoader.java:37)

Root Cause

Version mismatch between junit-platform-launcher and junit-platform-commons. The method CollectionUtils.forEachInReverseOrder(List, Consumer) was added in a newer version of junit-platform-commons, but the JDT Eclipse runtime bundles an older version.

Impact

  • All jdt_run_tests calls fail — the test loader cannot initialize
  • Tests can only be run via Maven (mvn test) as a workaround

Environment

  • Project: Spring Boot 3.x with JUnit 5.x
  • Java: 25
  • Build tool: Maven (multi-module)

Suggested Fix

Ensure junit-platform-commons version used at runtime matches the project's classpath version (from spring-boot-starter-test), not the JDT-bundled version.

## Bug Report ### Problem When running tests via `jdt_run_tests`, the JUnit5 test loader fails to initialize. All test runs end with a TIMEOUT. ### Error ``` java.lang.IllegalArgumentException: Error: test loader org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader not found: java.lang.reflect.InvocationTargetException 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:130) at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:113) at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.<init>(JUnit5TestLoader.java:37) ``` ### Root Cause Version mismatch between `junit-platform-launcher` and `junit-platform-commons`. The method `CollectionUtils.forEachInReverseOrder(List, Consumer)` was added in a newer version of `junit-platform-commons`, but the JDT Eclipse runtime bundles an older version. ### Impact - All `jdt_run_tests` calls fail — the test loader cannot initialize - Tests can only be run via Maven (`mvn test`) as a workaround ### Environment - Project: Spring Boot 3.x with JUnit 5.x - Java: 25 - Build tool: Maven (multi-module) ### Suggested Fix Ensure `junit-platform-commons` version used at runtime matches the project's classpath version (from `spring-boot-starter-test`), not the JDT-bundled version.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ai-tools/jdt-mcp-server#78
No description provided.