You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tibor Digana (Jira)" <ji...@apache.org> on 2022/02/22 15:07:00 UTC

[jira] [Comment Edited] (SUREFIRE-2007) Java 17 TestEngine with ID 'junit-vintage' failed to discover tests

    [ https://issues.apache.org/jira/browse/SUREFIRE-2007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17496154#comment-17496154 ] 

Tibor Digana edited comment on SUREFIRE-2007 at 2/22/22, 3:06 PM:
------------------------------------------------------------------

Hi [~bengineer],

Due to you said that the {{3.0.0-M6-SNAPSHOT}} works for you, I had to close this ticket.
Meanwhile use the version {{3.0.0-M6-SNAPSHOT}} from our Apache Maven Repository https://repository.apache.org/snapshots/
We do not have too many Jira tickets to do. There are three top issues to fix but it will take several days to complete.
If there is something more we can fix more, pls let us know.


was (Author: tibor17):
Hi [~bengineer],

Due to you said that the {{3.0.0-M6-SNAPSHOT}} works for you, I had to close this ticket.
Meanwhile use the version {{3.0.0-M6-SNAPSHOT}} from our Apache Maven Repository https://repository.apache.org/snapshots/
We do not have too many Jira tickets to do. There three top issues to fix but it will take several days to complete.
If there is something more we can fix more, pls let us know.

> Java 17 TestEngine with ID 'junit-vintage' failed to discover tests
> -------------------------------------------------------------------
>
>                 Key: SUREFIRE-2007
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-2007
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading, Junit 4.x support, Maven Surefire Plugin
>    Affects Versions: 3.0.0-M5
>         Environment: Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
> Maven home: /home/jenkins/tools/hudson.tasks.Maven_MavenInstallation/MVN3
> Java version: 17.0.1, vendor: Eclipse Adoptium, runtime: /home/jenkins/tools/hudson.model.JDK/JDK17/jdk-17.0.1+12
> Default locale: en_GB, platform encoding: UTF-8
> OS name: "linux", version: "5.4.0-74-generic", arch: "amd64", family: "unix"
>            Reporter: Ben Middleton
>            Assignee: Tibor Digana
>            Priority: Major
>
> We've recently switch our builds from Java 8 to Java 17, and we see some Failsafe tests failing with messages such as these:
> {code:java}
> org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-vintage' failed to discover tests
>         at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:160)
>         at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:134)
>         at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:108)
>         at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:80)
>         at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:110)
>         at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:78)
>         at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.discover(DefaultLauncherSession.java:81)
>         at org.junit.platform.launcher.core.SessionPerRequestLauncher.discover(SessionPerRequestLauncher.java:46)
>         at org.apache.maven.surefire.junitplatform.TestPlanScannerFilter.accept(TestPlanScannerFilter.java:56)
>         at org.apache.maven.surefire.api.util.DefaultScanResult.applyFilter(DefaultScanResult.java:102)
>         at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.scanClasspath(JUnitPlatformProvider.java:147)
>         at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:128)
>         at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428)
>         at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
>         at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562)
>         at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548)
> Caused by: java.lang.NoClassDefFoundError: com/mycompany/broker/StorageException
>         at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
>         at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
>         at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3427)
>         at java.base/java.lang.Class.getMethods(Class.java:2019)
>         at org.junit.platform.commons.util.ReflectionUtils.getDefaultMethods(ReflectionUtils.java:1518)
>         at org.junit.platform.commons.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:1491)
>         at org.junit.platform.commons.util.ReflectionUtils.findAllMethodsInHierarchy(ReflectionUtils.java:1433)
>         at org.junit.platform.commons.util.ReflectionUtils.findMethods(ReflectionUtils.java:1417)
>         at org.junit.platform.commons.util.ReflectionUtils.findMethods(ReflectionUtils.java:1403)
>         at org.junit.vintage.engine.descriptor.TestSourceProvider.lambda$findMethod$1(TestSourceProvider.java:75)
>         at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1220)
>         at java.base/java.util.Collections$SynchronizedMap.computeIfAbsent(Collections.java:2760)
>         at org.junit.vintage.engine.descriptor.TestSourceProvider.findMethod(TestSourceProvider.java:75)
>         at org.junit.vintage.engine.descriptor.TestSourceProvider.computeTestSource(TestSourceProvider.java:56)
>         at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
>         at org.junit.vintage.engine.descriptor.TestSourceProvider.findTestSource(TestSourceProvider.java:47)
>         at org.junit.vintage.engine.discovery.RunnerTestDescriptorPostProcessor.addChildrenRecursively(RunnerTestDescriptorPostProcessor.java:62)
>         at org.junit.vintage.engine.discovery.RunnerTestDescriptorPostProcessor.applyFiltersAndCreateDescendants(RunnerTestDescriptorPostProcessor.java:41)
>         at org.junit.vintage.engine.discovery.VintageDiscoverer.discover(VintageDiscoverer.java:46) {code}
> However, the class in question does exist in the classpath. We've tried updating the tests to the latest JUnit 4 and 5 versions, but we see the same issue on each.
> However, it I build the latest master branch of maven-surefire-plugin locally, and switch to this M6-SNAPSHOT, then the classpath loading works correctly.
> When will a new release of the plugin be pushed? Do you know which change since M5 fixed this class loading issue on Java 17?
> Thanks



--
This message was sent by Atlassian Jira
(v8.20.1#820001)