← All tasks
javajunit-team/junit-framework #1773Not a task: not reproduced

java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass Migrating to 5.4.0

envgap__junit-team__junit-framework-1773

Original GitHub issue ↗Opened 2019-02-12

01 / FAILURE SIGNATURE

As reported upstream

java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass(Ljava/lang/String;)Lorg/junit/platform/commons/function/Try;
Not a benchmark task.
  • No curated issue-specific recipe or verified environment fix is available.

02 / ENVIRONMENT RECIPE

Base commit
Not freshly verified
Manifest
pom.xml
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

junit-team/junit-framework #1773 · read the original issue
JDK: 11

Spring Boot: 2.1.2.RELEASE

JUnit: 5.4.0

Maven: 3.6.0

Surefire: 3.0.0-M3



At first, I got the following error running the tests on IntelliJ and using the command mvn clean install:

```

[INFO] --- maven-surefire-plugin:3.0.0-M3:test (default-test) @ xxxxx ---

[INFO]

[INFO] -------------------------------------------------------

[INFO]  T E S T S

[INFO] -------------------------------------------------------

Feb 12, 2019 12:53:00 PM org.junit.platform.launcher.core.DefaultLauncher handleThrowable

WARNING: TestEngine with ID 'junit-jupiter' failed to execute tests

java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass(Ljava/lang/String;)Lorg/junit/platform/commons/function/Try;

        at org.junit.jupiter.engine.support.OpenTest4JAndJUnit4AwareThrowableCollector.createAbortedExecutionPredicate(OpenTest4JAndJUnit4AwareThrowableCollecto

```



After adding this dependency, I could run the tests in IntelliJ but not using Maven:

```

        <dependency>

            <groupId>org.junit.platform</groupId>

            <artifactId>junit-platform-launcher</artifactId>

            <version>1.4.0</version>

            <scope>test</scope>

        </dependency>

```



Rolling back to version 5.3.2 solves the problem
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

conflict
Label rules and the text that matched
[
  {
    "category": "conflict",
    "rule": "signature.incompatible_declared_requirements",
    "source": "failure_signature",
    "excerpt": "java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass(Ljava/lang/String;)Lorg/junit/platform/commons/function/Try;"
  }
]

Issue-specific recipe and runtime smoke command require review against the complete issue and repository.

Legacy reproduction is generic install-only; match the actual issue failure before admission.