Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called

Tags:

maven

maven-3

I am using geb spock maven, with surefire version 2.22.0 on ubuntu. Till 2 weeks back it was working fine, but suddenly I am gettig ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called? error. Below is my configuration:

Maven Version: Apache Maven 3.6.0 
Java version: openjdk version "1.8.0_181"
M3_HOME : /opt/maven

When I hit mvn -Dtest="some test " test command it throws below error:

ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was /bin/sh -c cd /home/web/workspace/Durgesh_Delete1 && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /home/web/workspace/Durgesh_Delete1/target/surefire/surefirebooter1782527278200611298.jar /home/web/workspace/Durgesh_Delete1/target/surefire 2018-11-16T11-10-54_226-jvmRun3 surefire2754275980317815656tmp surefire_01299389042676135686tmp
Error occurred in starting fork, check output in log
Process Exit Code: 1

Below is my complete pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>net.digital.web</groupId>
    <artifactId>edge_bdd_automation</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <skipITTests>false</skipITTests>
        <geb.version>2.1</geb.version>
        <selenium.version>3.12.0</selenium.version>
        <groovy.version>2.4.15</groovy.version>
        <spock.version>1.1-groovy-2.4</spock.version>
        <gson.version>2.8.2</gson.version>
        <httpclient.version>4.3.4</httpclient.version>
        <httpcore.version>4.3.2</httpcore.version>
        <surefire.plugin.version>2.22.0</surefire.plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <!-- Groovy compiler for Spock/Geb tests -->
        <version.groovy-eclipse-compiler>2.9.2-01</version.groovy-eclipse-compiler>
        <version.groovy-eclipse-batch>2.4.3-01</version.groovy-eclipse-batch>
    </properties>

    <repositories>
        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>bintray</name>
            <url>http://jcenter.bintray.com</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>bintray-plugins</name>
            <url>http://jcenter.bintray.com</url>
        </pluginRepository>
    </pluginRepositories>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-core</artifactId>
            <version>${spock.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-all</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.gebish</groupId>
            <artifactId>geb-spock</artifactId>
            <version>${geb.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.gebish/geb-core -->
        <dependency>
            <groupId>org.gebish</groupId>
            <artifactId>geb-core</artifactId>
            <version>${geb.version}</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.google.code.gson</groupId>
                    <artifactId>gson</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
            <!--<scope>test</scope>-->
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>

        <!--Dependencies related to GEB SPOCK reporting-->
        <dependency>
            <groupId>com.athaydes</groupId>
            <artifactId>spock-reports</artifactId>
            <version>1.6.0</version>
            <scope>test</scope>
            <!-- this avoids affecting your version of Groovy/Spock -->
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>${groovy.version}</version>
        </dependency>

        <!-- // if you don't already have slf4j-api and an implementation of it in the classpath, add this! -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.25</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core -->
        <!-- This dependency is for support of Junit latest version -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/ru.yandex.qatools.ashot/ashot -->
        <dependency>
            <groupId>ru.yandex.qatools.ashot</groupId>
            <artifactId>ashot</artifactId>
            <version>1.5.4</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver -->
        <dependency>
            <groupId>com.codeborne</groupId>
            <artifactId>phantomjsdriver</artifactId>
            <version>1.4.4</version>
        </dependency>

        <!-- Geb - Spock Report -->
        <dependency>
            <groupId>com.aoe</groupId>
            <artifactId>geb-spock-reports</artifactId>
            <version>0.1.5</version>
            <type>pom</type>
        </dependency>

    </dependencies>

    <build>
        <plugins>

            <!-- Maven surefire plugin-->
            <!-- Uncommnet below for invoking parallel execution -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.plugin.version}</version>
                <dependencies>
                    &lt;!&ndash;SPOCK This is to force to use JUnit 4.7+ Runner &ndash;&gt;
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>${surefire.plugin.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <skipTests>${skipITTests}</skipTests>
                    <includes>
                        <include>*Spec.*</include>
                    </includes>
                    <systemPropertyVariables>
                        <geb.build.reportsDir>target/test-reports/geb</geb.build.reportsDir>
                    </systemPropertyVariables>

                    <parallel>classes</parallel>
                    <forkCount>5</forkCount>
                    <reuseForks>false</reuseForks>
                    <useUnlimitedThreads>true</useUnlimitedThreads>
                </configuration>
            </plugin>




            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <!-- IMPORTANT -->
                    <useIncrementalCompilation>false</useIncrementalCompilation>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <compilerId>groovy-eclipse-compiler</compilerId>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-compiler</artifactId>
                        <version>${version.groovy-eclipse-compiler}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-batch</artifactId>
                        <version>${version.groovy-eclipse-batch}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-compiler</artifactId>
                <version>${version.groovy-eclipse-compiler}</version>
                <extensions>true</extensions>
            </plugin>

        </plugins>
    </build>


</project>

Please look into this issue. Thanks

like image 948
Durgesh Avatar asked Nov 16 '18 11:11

Durgesh


1 Answers

Finally, I am able to solve this by adding below line under configuration tag of surefire plugin:

<configuration>
    <useSystemClassLoader>false</useSystemClassLoader>
    <threadCount>1</threadCount>
</configuration>

This has been mentioned in the solution suggested by Rushby in above comment, unfortunately no one has voted that answer so was difficult to catch. Thanks!

like image 116
Durgesh Avatar answered Oct 01 '22 09:10

Durgesh