[Gatling java api 3.8.3] Not generating the reports when loadtest are run in the CI with maven plugin

Loadtests are successful but reports are not generated at the end.

Could you please assist in resolving the dependencies with java api?

Here is the error message

Parsing log file(s) done
Generating reports...
Exception in thread "main" java.lang.NoClassDefFoundError: io/gatling/charts/component/impl/ComponentLibraryImpl
	at io.gatling.charts.component.ComponentLibrary$.<clinit>(ComponentLibrary.scala:43)
	at io.gatling.charts.report.ReportsGenerator.generateFor(ReportsGenerator.scala:51)
	at io.gatling.app.RunResultProcessor.generateReports(RunResultProcessor.scala:65)
	at io.gatling.app.RunResultProcessor.processRunResult(RunResultProcessor.scala:40)
	at io.gatling.app.Gatling$.start(Gatling.scala:100)
	at io.gatling.app.Gatling$.fromArgs(Gatling.scala:52)
	at io.gatling.app.Gatling$.main(Gatling.scala:40)
	at io.gatling.app.Gatling.main(Gatling.scala)
Caused by: java.lang.ClassNotFoundException: io.gatling.charts.component.impl.ComponentLibraryImpl
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
	... 8 more

Here is my pom looks like

<?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>com.load-tests</groupId>
  <artifactId>load-tests</artifactId>
  <version>3.8.3</version>

  <properties>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <maven.compiler.release>11</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <gatling.version>${project.version}</gatling.version>
    <gatling-maven-plugin.version>4.2.6</gatling-maven-plugin.version>
    <maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
    <maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>${gatling.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-charts</artifactId>
      <version>${gatling.version}</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-app</artifactId>
      <version>${gatling.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <version>2.13.3</version>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>2.8.7</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.11.0</version>
    </dependency>
  </dependencies>

  <build>
    <defaultGoal>install</defaultGoal>
    <plugins>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>${gatling-maven-plugin.version}</version>
        <executions>
          <execution>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <configFolder>src/test/resources</configFolder>
              <resultsFolder>target/gatling/results</resultsFolder>
              <propagateSystemProperties>true</propagateSystemProperties>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven-jar-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4.1</version>
        <configuration>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
          <finalName>${project.build.finalName}</finalName>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <release>11</release>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

The gatling-charts-highcharts jar in the maven local cache is corrupted.
You have to remove it so download is re-triggered on next execution.

Hi @slandelle
Thanks for the hint. I did that but still I am not able to generate reports.

Here is the command that I used to execute the tests

java -cp target/java-api-3.8.3-jar-with-dependencies.jar io.gatling.app.Gatling simulationClassName

Here is the response.

Generating reports...
Exception in thread "main" java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated
        at io.gatling.charts.report.ReportsGenerator.generateFor(ReportsGenerator.scala:47)
        at io.gatling.app.RunResultProcessor.generateReports(RunResultProcessor.scala:65)
        at io.gatling.app.RunResultProcessor.processRunResult(RunResultProcessor.scala:40)
        at io.gatling.app.Gatling$.start(Gatling.scala:100)
        at io.gatling.app.Gatling$.fromArgs(Gatling.scala:52)
        at io.gatling.app.Gatling$.main(Gatling.scala:40)
        at io.gatling.app.Gatling.main(Gatling.scala)

Actually tests are successfully executed

This last error is pretty self-explained:

There were no requests sent during the simulation, reports won't be generated

What does your Simulation like? Does it contain at least one scenario? Does this scenario contain at least one request (http("your.website.com").get("/"))?

Cheers!

Hi @sbrevet
My simulations are working fine when I execute locally. I have been using gatling since 2019 with scala api.

Now I am trying to develop loadtest framework with java api.
Report generation is failing when I execute the tests in the cluster(containerised execution)

I can see the tests results in the console out put as below

================================================================================
2022-09-09 12:14:40                                           1s elapsed
---- Requests ------------------------------------------------------------------
> Global                                                   (OK=1      KO=0     )
> create household                                         (OK=1      KO=0     )

This thread is non sensical.
The title is about not being able to launch from the gatling-maven-plugin, then you’re saying you’re building a fatjar and launching directly a java -cp command, which is not a usage we support.

And then you’re reporting an error that happens when your scenario is empty.

Please stick to using the gatling-maven-plugin and launching mvn gatling:test.