Compatibility Issue: Gatling 3.12.0 with Java 22

Hello Gatling Community,

I recently upgraded both Gatling to version 3.12.0 and Java to version 22 in my project, but I’m encountering a recurring issue, which seems to be related to the compatibility between these versions.

Issue Description:

After upgrading to Java 22 and Gatling 3.12.0, the build fails with the following error during execution:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

It appears that there is a certificate validation issue (PKIX path building failed), but the same setup works fine when I roll back to Java 21. I suspect that this issue may stem from Java 22 being experimental or certain libraries not being fully compatible with this version of Java yet.

What I Have Tried:

  1. Reverted to Java 21 with Gatling 3.12.0, and the error no longer occurs.

  2. Checked the JDK trust store to ensure there are no missing certificates.

  3. Added SSL debugging, but the issue persists when using Java 22.

  4. Temporarily disabled SSL validation (not ideal), which bypasses the error but isn’t a long-term solution.

Questions:

• Is Gatling 3.12.0 officially compatible with Java 22, or are there any known limitations or upcoming updates to support this version?

• Has anyone successfully run Gatling with Java 22, and if so, are there any workarounds or configurations that need to be applied?

Any insights or suggestions would be greatly appreciated! I am eager to understand whether this is purely a compatibility issue or if there are specific adjustments I can make in my setup.

Thanks in advance for your support!

System Details:

Gatling Version: 3.12.0

Java Version: 22

OS: macOS

It’s utterly impossible it’s a compatibility issue between your Java version and Gatling.
Gatling doesn’t do anything fancy there and just uses plain Java for loading truststores and keystores.

Similarly, I highly doubt this could be a regression in Java 22.

I’m 100% sure the cert missing from your truststore. You probably want to verify your step 2.

Hello everyone,

I wanted to share an update regarding a recent issue I faced while working with Gatling. Initially, I encountered a certificate problem, which I was concerned might be related to compatibility issues. However, I was able to resolve the certificate issue without it being a compatibility problem.

To fix the certificate issue, I followed these steps:

  1. Check the SSL/TLS Configuration: I ensured that my SSL certificates were correctly configured and accessible to the Gatling application.

  2. Update Java’s Truststore: I imported the necessary certificates into Java’s truststore using the following command:

keytool -import -alias mycert -file path/to/mycert.crt -keystore $JAVA_HOME/lib/security/cacerts -storepass changeit

  1. Restart Gatling: After updating the truststore, I restarted the Gatling application to apply the changes.

After fixing the certificate issue, I encountered a new error:


java.lang.IllegalArgumentException: Can't use the file DataWriter without setting the results directory

To resolve this error, I updated my Gradle build script to specify a results directory. I modified the project.javaexec block as follows:

Before:

project.javaexec {
    main = 'io.gatling.app.Gatling'
    classpath = project.sourceSets.main.runtimeClasspath
    args '-bf', project.sourceSets.main.output,    // target folder where gatling will compile the simulation
         '-s', simulationClass,                     // The simulation to run
         '-rsf', 'src/main/resources/data'         // data feeder directory
    jvmArgs = ['-DnumUsers=' + numUsers,
               '-Dtps=' + tps,
               '-DdurationSec=' + durationSec,
               '-DinitialTps=' + initialTps,
               '-DtpsIncreaseStep=' + tpsIncreaseStep,
               '-DstepDurationSec=' + stepDurationSec,
               '-Dtestenv=' + testenv,
               '-Dsun.net.inetaddr.ttl=0'] + addJvmArgs
}

After:


project.javaexec {
    main = 'io.gatling.app.Gatling'
    classpath = project.sourceSets.main.runtimeClasspath
    args '-bf', project.sourceSets.main.output,    // target folder where gatling will compile the simulation
         '-s', simulationClass,                     // The simulation to run
         '-rsf', 'src/main/resources/data',         // data feeder directory
         '-rf', 'build/results/'                     // results directory (specify your path)
    jvmArgs = ['-DnumUsers=' + numUsers,
               '-Dtps=' + tps,
               '-DdurationSec=' + durationSec,
               '-DinitialTps=' + initialTps,
               '-DtpsIncreaseStep=' + tpsIncreaseStep,
               '-DstepDurationSec=' + stepDurationSec,
               '-Dtestenv=' + testenv,
               '-Dsun.net.inetaddr.ttl=0'] + addJvmArgs
}

By adding the -rf argument to specify the results directory, I was able to successfully run my Gatling simulations without encountering any further errors.

I hope this helps anyone facing similar issues!

Best regards,
Natalia