Getting an exception “org.apache.maven.surefire.booter.SurefireBooterForkException: . VM crash or System.exit called?”

Tags: , , , ,



I am working on a Selenium Automation project which is based on Maven Cucumber + TestNg. While on run i am getting the below exception not sure but tried all the possibilities of incrementing or decrementing the Surefire versions.

Error occurred in starting fork, check output in log Process Exit Code: 1 org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?

Really wasting lot of my time here with above said issue in clearing errors but nothing worked out.

So please kindly provide me a solution , i am more desperate to know the solution.

My Configuration : JDK version : 1.8 Maven Version: tried with 3.5.4 , 3.6.3 Surefire version : tried with lower versions also 2.18, 2.19,2.22.0,2.22.2 now currently 3.0.0-M2

My Pom is given below

4.0.0 ROL ROL 0.0.1-SNAPSHOT jar

<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <aspectj.version>1.7.4</aspectj.version>
    <allure.version>1.4.22</allure.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.surefire.verion>3.0.0-M2</maven.surefire.verion>
    <io.cucumber.verion>4.2.1</io.cucumber.verion>

</properties>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
            <!-- <configuration> <source>${maven.compiler.source}</source> <target>${maven.compiler.target}</target> 
                <fork>true</fork> <executable>C:Program FilesJavajdk1.8.0_191binjavac</executable> 
                </configuration> -->
        </plugin>
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.0.1</version>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${basedir}/target/test-classes</outputDirectory>
                        <resources>
                            <resource>
                                <directory>src/main/resources</directory>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M2</version>

            <configuration>
                                    
                        
                <systemPropertyVariables>
                    <propertyName>java.library.path</propertyName>
                    <buildDirectory>src/main/resources/configFile</buildDirectory>

                </systemPropertyVariables>
                <testFailureIgnore>true</testFailureIgnore>
                <argLine>
                    -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
                </argLine>
                <properties>
                    <property>
                        <name>dataproviderthreadcount</name>
                        <value>2</value>
                    </property>
                </properties>
                <suiteXmlFiles>
                    com.ryder.online
                    <suiteXmlFile>src/test/java/com/ryder/online/test/testng/testng.xml</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.2.10.v20150310</version>
        </plugin>
        <!-- <plugin> <groupId>ch.fortysix</groupId> <artifactId>maven-postman-plugin</artifactId> 
            <version>0.1.6</version> <executions> <execution> <id>send_an_email</id> 
            <phase>test</phase> <goals> <goal>send-mail</goal> </goals> <inherited>false</inherited> 
            <configuration> <mailhost>smtp.gmail.com</mailhost> <mailport>465</mailport> 
            <mailauth>true</mailauth> <mailssl>true</mailssl> <mailAltConfig>true</mailAltConfig> 
            <mailuser>rydertest12@gmail.com</mailuser> <mailpassword>Ryder@123</mailpassword> 
            <from>rydertest12@gmail.com</from> <subject>UVS E-commerce Automation Report 
            </subject> <failonerror>true</failonerror> <htmlMessage> <![CDATA[ <p>Hi,</p> 
            <p>Check out the attached test execution report.</p> <p>From,</p> <p>Madhu 
            Golla</p> <p>UVS Automation Team</p> ]]> </htmlMessage> <receivers> <receiver>Madhu_Golla@ryder.com</receiver> 
            <receiver>rydertest12@gmail.com</receiver> </receivers> <fileSets> <fileSet> 
            <directory>${basedir}/Automation_Report/Reports</directory> <includes> <include>**/Report.html</include> 
            </includes> </fileSet> </fileSets> </configuration> </execution> </executions> 
            </plugin> -->
    </plugins>
</build>

<dependencies>
    <!--Cucumber Dependencies -->


    <!-- cucumber-java -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <!-- <version>${io.cucumber.verion}</version> -->
        <version>4.2.1</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-jvm</artifactId>
        <!-- <version>5.1.0</version> -->
        <version>4.2.1</version>
        <type>pom</type>
    </dependency>

    <!--cucumber-jvm-deps <dependency> <groupId>io.cucumber</groupId> <artifactId>cucumber-jvm-deps</artifactId> 
        <version>1.0.6</version> </dependency> -->

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-core</artifactId>
        <!-- <version>5.1.0</version> -->
        <version>4.2.1</version>
        <!-- <version>1.2.6</version> -->
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-gherkin</artifactId>
        <!-- <version>3.2.0</version> -->
        <version>5.1.0</version>
    </dependency>

    <!-- cucumber-testng -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-testng</artifactId>
        <!-- <version>${io.cucumber.verion}</version> -->
        <version>4.2.1</version>
    </dependency>

    <!-- cucumber-picocontainer -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>${io.cucumber.verion}</version>
    </dependency>



    <!-- https://mvnrepository.com/artifact/org.json/json -->
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20180813</version>
    </dependency>
    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>4.1.2</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
    <!-- <dependency> <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> 
        <version>1.1.1</version> </dependency> -->



    <!-- Logging -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.5</version>
    </dependency>

    <!-- Extent Reports -->
    <!-- <dependency> <groupId>com.vimalselvam</groupId> <artifactId>cucumber-extentsreport</artifactId> 
        <version>3.0.2</version> </dependency> <dependency> <groupId>com.aventstack</groupId> 
        <artifactId>extentreports</artifactId> <version>3.1.2</version> </dependency> 
        <dependency> <groupId>com.relevantcodes</groupId> <artifactId>extentreports</artifactId> 
        <version>2.41.1</version> </dependency> -->

    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports</artifactId>
        <version>4.0.9</version>
    </dependency>
    <!-- extentreports-cucumber4-adapter -->
    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports-cucumber4-adapter</artifactId>
        <version>1.0.8</version>
    </dependency>

    <!-- Testng -->
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.maven.surefire/surefire-testng -->
    <dependency>
        <groupId>org.apache.maven.surefire</groupId>
        <artifactId>surefire-testng</artifactId>
        <version>3.0.0-M2</version>
    </dependency>



    <!-- Selenium -->
    <!-- io.github.bonigarcia webdrivermanager -->

    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>3.5.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>3.141.59</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>4.0.0-alpha-4</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.paulhammant/ngwebdriver -->
    <dependency>
        <groupId>com.paulhammant</groupId>
        <artifactId>ngwebdriver</artifactId>
        <version>1.1.4</version>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-htmlunit-driver</artifactId>
        <version>2.52.0</version>
    </dependency>
    <!-- org.sikuli/sikuli-api -->
    <dependency>
        <groupId>org.sikuli</groupId>
        <artifactId>sikuli-api</artifactId>
        <version>1.2.0</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.10.1</version>
    </dependency>

    <!-- rest-assured-io -->
    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>rest-assured</artifactId>
        <version>3.3.0</version>
    </dependency>
    <!-- SQL SERVER JDBC DRIVER -->
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <version>7.2.1.jre8</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.fusesource.jansi/jansi -->

</dependencies>
<name>ROL</name>

Console Output

[INFO]  T E S T S
[INFO] -------------------------------------------------------
[WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file D:JDA_Projecttargetsurefire-reports2020-06-30T16-57-34_744-jvmRun1.dumpstream
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[ERROR] There are test failures.

Please refer to D:JDA_Projecttargetsurefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was cmd.exe /X /C ""C:Program FilesJavajdk1.8.0_251jrebinjava" -javaagent:C:UsersXXXX.m2repository/org/aspectj/aspectjweaver/1.7.4/aspectjweaver-1.7.4.jar -jar "C:UsersBalaji SInghAppDataLocalTempsurefire1099821871492178220surefirebooter6557031630400864690.jar" "C:UsersxxxxAppDataLocalTempsurefire1099821871492178220" 2020-06-30T16-57-34_744-jvmRun1 surefire5334753707605775945tmp surefire_08619917104831991186tmp"
Error occurred in starting fork, check output in log
Process Exit Code: 1
org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was cmd.exe /X /C ""C:Program FilesJavajdk1.8.0_251jrebinjava" -javaagent:C:Usersxxxx.m2repository/org/aspectj/aspectjweaver/1.7.4/aspectjweaver-1.7.4.jar -jar "C:Usersxxxx AppDataLocalTempsurefire1099821871492178220surefirebooter6557031630400864690.jar" "C:UsersxxxxAppDataLocalTempsurefire1099821871492178220" 2020-06-30T16-57-34_744-jvmRun1 surefire5334753707605775945tmp surefire_08619917104831991186tmp"
Error occurred in starting fork, check output in log
Process Exit Code: 1
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:670)
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:283)
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:246)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1159)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1000)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:846)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.996 s
[INFO] Finished at: 2020-06-30T16:57:35+05:30
[INFO] Final Memory: 41M/398M

Answer

In my case i had problems with my user profile which had spaces in between.

Have resolved my issue and its working fine now. The issue was related to my Profile Name which had spaces in between so changed it by removing spaces and after that even with lower versions of surefire and with latest version its working fine.

The User profile can be found under C:/Users/<userprofile>

Changed my Profile user name from"Balaji Singh" to "BalajiSingh" and with updation on surefire version in  pom everything started working.

    [INFO] -------------------------------------------------------
    [INFO]  T E S T S
    [INFO] -------------------------------------------------------
    [INFO] Running TestSuite
    chrome
    2020-07-10 11:05:59 [INFO ] [InitializeWebDrive] - [standAloneStepUp] CHROME
    Starting ChromeDriver 2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5) on port 10704
    Only local connections are allowed.
    [1594359363.546][WARNING]: Timed out connecting to Chrome, retrying...
    Jul 10, 2020 11:06:05 AM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Detected dialect: OSS
    [1594359367.679][WARNING]: Timed out connecting to Chrome, retrying...
    chrome
    2020-07-10 11:06:09 [INFO ] [InitializeWebDrive] - [before] CHROME
    ChromeDriver: chrome on XP (c79a5836b92a01f0250044d972add9af)
    *****************************
    ROL home page should be visible
    currently system is on ROL entry home page
    navigated to ShipmentEntry page successfully
    1 Scenarios (1 passed)
    21 Steps (21 passed)
    2m55.358s
    
    [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 176.404 s - in TestSuite
    [INFO] 
    [INFO] Results:
    [INFO] 
    [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 03:04 min
    [INFO] Finished at: 2020-07-10T11:08:54+05:30
    [INFO] Final Memory: 42M/398M
    [INFO] ------------------------------------------------------------------------


Source: stackoverflow