Problem with failing tests on new powerful server

We have provisioned a new server to use for our build system.

We have some failing tests on the new server, a problem we do not have on the old servers.

  • The old servers are running SLES15.2 in a VMWare VM, with 4 CPU Cores and 8GB RAM.
  • The new server is running SLES15.2 on bare metal, with 56 CPU Cores and 256GB RAM.

The project is an JavaFX application, which has JUnit 4 and JUnit 5 tests. Some tests are using Mockito and Powermock.

test {
    systemProperty 'java.awr.headless', 'true'

Running the test standalone works fine.
./gradlew clean test --tests MyFailingTestClass

I thought perhaps it was a problem with multiple tests running in parallel and some race conditions.
However both Old and New server are running one test at a time, no parallelization (it seems to me in the output, only one tests row).
I even tried using parallelization with setting maxParallelForks, but that did not work.

It makes it difficult to find out why it fails, when running the test standalone works.

With no parallelization, 34 tests out of 1979 fails.
With parallelization, 3 tests out of 1979 fails.

The tests fails with only one java.lang.NullPointerException and most java.lang.NoClassDefFoundError, all for the same class,

This TelemetryBroker is a Singleton and static, and used in many of the tests.
public static TelemetryBroker obj() { return INSTANCE; }.
The NoClassDefFoundError happens on the call to TelemetryBroker.obj().

Some refactoring of the code might be necessary, but how at first do I get the tests to succeed on the new server?

On a subnote: Running the tests with maxParallelForks Runtime.runtime.availableProcessors(), or maxParallelForks Runtime.runtime.availableProcessors().intdiv(2) ?: 1 made the tests take a little longer to finish on the new server.