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

Tibor Digana commented on SUREFIRE-1837:
----------------------------------------

[~Enigo]
The problematic artifact {{apiguardian-api-1.0.0}} is part of JUnit5, right?
If two or more modules are running in parallel, it would be fine to list all of 
them which prooves the hypothesis that they attempt to download the artifact 
concurrently, lock it which probably cause the issue that the artifact could 
not be properly resolved, or the collections are not threadsafe (JMM concept 
JSR-133) and the artifact is not visible in the plugin's Thread.

> NullPointerException at AbstractSurefireMojo$ClasspathCache.setCachedClasspath
> ------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-1837
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1837
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 3.0.0-M5
>         Environment: mvn --version
> Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
> Maven home: /opt/apache-maven-3.6.3
> Java version: 11.0.8, vendor: Amazon.com Inc., runtime: 
> /usr/lib/jvm/java-11-amazon-corretto
> Jenkins ver. 2.204.6 on Ubuntu 18
>            Reporter: Ruslan Sibgatullin
>            Priority: Major
>
> While migrating a rather old and big project from Java 8 to Java 11 the 
> following exception happens occasionally (once in 3-4 builds):
> {code:java}
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) 
> on project my_project: Execution default-test of goal 
> org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test failed.: 
> NullPointerException -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
> goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test 
> (default-test) on project cachereloader-validation: Execution default-test of 
> goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test failed.
>  at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:215)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:156)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:148)
> at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
> (LifecycleModuleBuilder.java:117)
> at 
> org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call
>  (MultiThreadedBuilder.java:190)
> at 
> org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call
>  (MultiThreadedBuilder.java:186)
> at java.util.concurrent.FutureTask.run (FutureTask.java:264)
> at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
> at java.util.concurrent.FutureTask.run (FutureTask.java:264)
> at java.util.concurrent.ThreadPoolExecutor.runWorker 
> (ThreadPoolExecutor.java:1128)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run 
> (ThreadPoolExecutor.java:628)
> at java.lang.Thread.run (Thread.java:834)
> Caused by: org.apache.maven.plugin.PluginExecutionException: Execution 
> default-test of goal 
> org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test failed.
>  at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo 
> (DefaultBuildPluginManager.java:148)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:210)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:156)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:148)
> at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
> (LifecycleModuleBuilder.java:117)
> at 
> org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call
>  (MultiThreadedBuilder.java:190)
> at 
> org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call
>  (MultiThreadedBuilder.java:186)
> at java.util.concurrent.FutureTask.run (FutureTask.java:264)
> at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
> at java.util.concurrent.FutureTask.run (FutureTask.java:264)
> at java.util.concurrent.ThreadPoolExecutor.runWorker 
> (ThreadPoolExecutor.java:1128)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run 
> (ThreadPoolExecutor.java:628)
> at java.lang.Thread.run (Thread.java:834)
> Caused by: java.lang.NullPointerException
> at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo$ClasspathCache.setCachedClasspath
>  (AbstractSurefireMojo.java:4121)
> at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo$ClasspathCache.access$200
>  (AbstractSurefireMojo.java:4102)
> at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.newStartupConfigWithClasspath
>  (AbstractSurefireMojo.java:1913)
> at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.createStartupConfiguration
>  (AbstractSurefireMojo.java:1894)
> at org.apache.maven.plugin.surefire.AbstractSurefireMojo.createForkStarter 
> (AbstractSurefireMojo.java:2374)
> at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider 
> (AbstractSurefireMojo.java:1310)
> at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked
>  (AbstractSurefireMojo.java:1159)
> at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute 
> (AbstractSurefireMojo.java:932)
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo 
> (DefaultBuildPluginManager.java:137)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:210)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:156)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:148)
> at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
> (LifecycleModuleBuilder.java:117)
> at 
> org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call
>  (MultiThreadedBuilder.java:190)
> at 
> org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call
>  (MultiThreadedBuilder.java:186)
> at java.util.concurrent.FutureTask.run (FutureTask.java:264)
> at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
> at java.util.concurrent.FutureTask.run (FutureTask.java:264)
> at java.util.concurrent.ThreadPoolExecutor.runWorker 
> (ThreadPoolExecutor.java:1128)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run 
> (ThreadPoolExecutor.java:628)
> at java.lang.Thread.run (Thread.java:834){code}
> With exactly the same setup but using Java 8 this exception doesn't occur.
> The tests run on Jenkins ver. 2.204.6 like this:
> {code:java}
>  realtimeJUnit('**/target/surefire-reports/*.xml') {
>      sh "mvn test -e -T 1C"
>  }
> {code}
> {code:java}
> mvn --version
> Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
> Maven home: /opt/apache-maven-3.6.3
> Java version: 11.0.8, vendor: Amazon.com Inc., runtime: 
> /usr/lib/jvm/java-11-amazon-corretto
> {code}
> Also, with the plugin version 2.22.2 there is no exception but also 
> occasionally some random tests fail with 
> {code:java}
> java.lang.NoClassDefFoundError: 
> ....
> Caused by: java.lang.ClassNotFoundException: 
> {code}
> even thought classes are located right next to each other (sometimes it even 
> fails to find  inner static class)
> Plugin configuration
> {code:java}
> <plugin>
>     <groupId>org.apache.maven.plugins</groupId>
>     <artifactId>maven-surefire-plugin</artifactId>
>     <version>${surefire.version}</version>
>     <configuration>
>         <argLine>@{jacoco.agent.argLine} -Xmx512m -Xms256m 
> ${custom.test.argLine}</argLine>
>         <includes>
>             <include>**/*Test.java</include>
>             <include>**/*Specification.java</include>
>         </includes>
>         <excludes>
>             <exclude>**/*IntegrationTest.java</exclude>
>         </excludes>
>         <forkCount>1</forkCount>
>         
> <forkedProcessTimeoutInSeconds>${test.timeout}</forkedProcessTimeoutInSeconds>
>         <runOrder>random</runOrder>
>         <reuseForks>true</reuseForks>
>         <rerunFailingTestsCount>1</rerunFailingTestsCount>
>         <testFailureIgnore>true</testFailureIgnore>
>     </configuration>
> </plugin>
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to