CircleCI build failure on OpenJDK image

Hello everyone,

I have the following error when I run my CircleCI build.

   -------------------------------------------------------

T E S T S

Error: Could not find or load main class org.apache.maven.surefire.booter.ForkedBooter
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.358 s
[INFO] Finished at: 2018-10-29T19:06:42Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test)
on project ITEL: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test
failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/circleci/project && /usr/lib/jvm/java-8-openjdkamd64/
jre/bin/java -jar /home/circleci/project/target/surefire/surefirebooter5978716246735215649.jar
/home/circleci/project/target/surefire/surefire950994743239780003tmp
/home/circleci/project/target/surefire/surefire_06908202691549979861tmp
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
Exited with code 1

Few days ago everything worked fine. Since then nothing in configuration was changed.
When I run me tests locally the error doesn’t occur.

If more details are needed I will provide.

Thank you in advance.

1 Like

I got same ERROR since 2018/10/26 00:52:00 UTC.

pom setting is

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
    <!-- CircleCI build workaround -->
    <argLine>${surefireArgLine} -Xms1024m -Xmx2048m</argLine>
    <reuseForks>true</reuseForks>
</configuration>
<version>2.20.1</version><!--$NO-MVN-MAN-VER$-->

using

Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
Maven home: /opt/apache-maven
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en, platform encoding: UTF-8
OS name: “linux”, version: “4.4.0-137-generic”, arch: “amd64”, family: “unix”

i think it may related OpenJDK updated version.
But i have not got any clue.
Does anyone resolved it?

@Svyatoslav
Below configuration worked for me.

Reason : Error: Could not find or load main class org.apache.maven.surefire.booter.ForkedBooter
Solution : Set useSystemClassLoader to false

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <!-- CircleCI build workaround -->
                <argLine>${surefireArgLine} -Xms1024m -Xmx2048m</argLine>
                <reuseForks>true</reuseForks>
                <useSystemClassLoader>false</useSystemClassLoader>
            </configuration>
            <version>2.20.1</version><!--$NO-MVN-MAN-VER$-->
        </plugin>
3 Likes

Thank you very much indeed for sharing that answer, it works. :+1::grinning:

Same problem here.
The solution works, but I want to know why this happens.
What changed?

1 Like

I also experienced this error. It would be really nice to know what the root cause of this is. Thanks for the solution though :slight_smile:

Yup same here, all builds all the sudden are broken, obviously CircleCI changed something but I’m not even sure what would cause this to, all-the-sudden, break - CirclCI folks, any ideas?

I believe what changed was the circleci docker images tagged as circleci/openjdk:8-* upgrade from Java 8u171 to 8u181.

I found this report that sheds a little light on it: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911925

4 Likes

I rolled back to 8u171 and got my builds work again.
- image: circleci/openjdk:8u171-jdk

3 Likes

That is incorrect. Java remained at 8u181.

The change is the build number from 1 to 2:

Old:

build 1.8.0_181-8u181-b13-1~deb9u1-b13

New:

build 1.8.0_181-8u181-b13-2~deb9u1-b13

I’m also having the issue, which openjdk tag should I use? I’m not able to see the tag 8u171 in https://hub.docker.com/r/circleci/openjdk/tags/. Can I still use it? Thanks

Hey guys, I hit the same problem by using circleci/openjdk:8-jdk image to build in circleci. Which image for alternative for solving this?
@um-zagaa Can you point me what this piece actually doing? <useSystemClassLoader>false</useSystemClassLoader>

Hi @eegiimgl
userSystemClassLoader=true is using manifest-only JAR, userSystemClassLoader=false is using basic plain old Java classpath.

read details from here Class Loading

btw, I am mongolian too :sweat_smile:

Thanks a lot!!! That saves my day!!!

Oh cool! Thanks!
It helped to me. @um-zagaa Nice to meet you!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.