Maven error occurred in starting fork, check output in log

16,568

Solution 1

I was facing the same issue, adding below worked for me: version 3.0.0-M3 fixes the problem

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M3</version>
        <configuration>
            <forkCount>0</forkCount>
            <testFailureIgnore>true</testFailureIgnore>
        </configuration>
</plugin>

Solution 2

I also faced this in my local environment (build was working fine on other environments). So I did not revise pom.xml, instead, I added forkCount=0 as command line argument and it solved the problem. Like:

mvn clean install -DforkCount=0

Solution 3

I was also facing the same issue.

[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: Error occurred in starting fork, check output in log

In my context, I was building a spring boot application. All tests were ok, BUT, the application did not close properly due to an issue in the app code shutdown process. I guess that the process was not returning an exit code equals to 0.

Once we fixed this shutdown issue, this surefire plugin exception did not occured anymore.

It may be an hint to your problem.

Share:
16,568

Related videos on Youtube

alexanoid
Author by

alexanoid

Updated on September 19, 2022

Comments

  • alexanoid
    alexanoid over 1 year

    I use Maven, docker-maven-plugin and Spring Boot. Right now I run into the following issue:

    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 03:08 min
    [INFO] Finished at: 2018-03-30T20:31:08+03:00
    [INFO] Final Memory: 76M/1162M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.20.1:verify (default) on project domain: There are test failures.
    [ERROR]
    [ERROR] Please refer to D:\Projects\decisionwanted\domain\target\failsafe-reports for the individual test results.
    [ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
    [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
    [ERROR] Command was cmd.exe /X /C "c:\Java\jdk1.8.0_162\jre\bin\java -jar C:\Users\ALEXAN~1\AppData\Local\Temp\surefire7684467242957210997\surefirebooter6934205730694228299.jar C:\Users\Alexander\AppData\Local\Temp\surefire7684467242957210997 2018-03-30T20-28-03_824-jvmRun1 surefire8708053899862809316tmp surefire_06397887630134904290tmp"
    [ERROR] Error occurred in starting fork, check output in log
    [ERROR] Process Exit Code: 1
    [ERROR] Crashed tests:
    [ERROR] com.decisionwanted.domain.DecisionCharacteristicIT
    [ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:686)
    [ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:535)
    [ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:280)
    [ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
    [ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1124)
    [ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:954)
    [ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:832)
    [ERROR]         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    [ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    [ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
    [ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
    [ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    [ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    [ERROR]         at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    [ERROR]         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    [ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
    [ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
    [ERROR]         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
    [ERROR]         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
    [ERROR]         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
    [ERROR]         at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
    [ERROR]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [ERROR]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    [ERROR]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [ERROR]         at java.lang.reflect.Method.invoke(Method.java:498)
    [ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    [ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    [ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    [ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    [ERROR] -> [Help 1]
    

    I read that this issue can be potentially related to maven-surefire-plugin so I have added to my parent pom:

    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <forkCount>0</forkCount>
                </configuration>
            </plugin>
        <plugins>
    </pluginManagement>
    

    and to inherited poms:

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
        </plugin>
    </plugins>
    

    but it doesn't help.

    How to fix this issue ?

    • khmarbaise
      khmarbaise about 6 years
      Try to downgrade to 2.19.1 instead ..?
    • khmarbaise
      khmarbaise about 6 years
      Please set the version to 2.19.1...
    • khmarbaise
      khmarbaise about 6 years
      No you shouldn't need it...
    • alexanoid
      alexanoid about 6 years
      @khmarbaise thanks for your suggestion! I have set the maven-failsafe-plugin and maven-surefire-plugin versions to 2.18.1 and looks like the issue is gone
  • ThetaSinner
    ThetaSinner about 5 years
    Can you provide any explanation as to why this would solve the problem? I'm cautious to use it without knowing what it does.
  • Luis
    Luis over 3 years
    There's always the documentation: maven.apache.org/surefire/maven-surefire-plugin/examples/… That link explains how OS limitations cause these problems, the trade-offs involved in the possible approaches and a potential solution.